I created completeall2
API in Azure Mobile service..
exports.post = function(request, response) {
var mssql = request.service.mssql;
var sql = "SELECT * from productmovement";
mssql.query(sql, {
success: function(results) {
response.send(200, results);
} }) };
What's Code for store this results
into my ArrayList<ProductMovement>
in my app..
What i did to overcome this problem, is to call a different overload of invokeApi that returns a JsonElement, and then deserialise it into my objects like so:
mClient.invokeApi("productmovement",new ApiJsonOperationCallback() {
@Override
public void onCompleted(JsonElement jsonElement, Exception e, ServiceFilterResponse serviceFilterResponse) {
GsonBuilder gsonb = new GsonBuilder();
Gson gson = gsonb.create();
JsonArray array = jsonElement.getAsJsonArray();
List<MyObject> myObjects = new ArrayList<MyObject>()>
for(int i = 0; i < array.size(); i++)
{
myObjects.add(gson.fromJson(array.get(i).getAsJsonObject().toString(), MyObject.class));
}
}
});