I am creating a app which capture images and stores into Internal storage as well as local storage in ActiveAndroid. In starting i have faced many issues regarding OutofMemory error. But I have cured that error by handling and compressing image after go through here. But now when I am getting list from ActiveAndroid app crashes in some device and gives outofMemory error. Below is my code and error Response.
In Background Service I am getting List like:
List<ImageUploadModel> imagesList = ImageUploadModel.getUnUploadedImageListonintimation(uploadImageModel.getIntimationId());
In active android my Query is
public static List<ImageUploadModel> getUnUploadedImageListonintimation(String IntimationId) {
return new Select().from(ImageUploadModel.class).where("intimationId=?", IntimationId).where("isImageDetailsUpload=?", false).execute();
}
I am getting error
Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 422472 byte allocation with 343696 free bytes and 335KB until OOM
at android.database.CursorWindow.nativeGetString(CursorWindow.java)
at android.database.CursorWindow.getString(CursorWindow.java:438)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:66)
at com.activeandroid.Model.loadFromCursor(Unknown Source)
at com.activeandroid.util.SQLiteUtils.processCursor(Unknown Source)
at com.activeandroid.util.SQLiteUtils.rawQuery(Unknown Source)
at com.activeandroid.query.From.execute(Unknown Source)
at com.xxxxxxxxx.xxxxxxxxxxx.Model.ImageUploadModel.getUnUploadedImageListonintimation(Unknown Source)
at com.xxxxxxxxx.xxxxxxxxxxx.Service.UploadImageService$3.getResponce(Unknown Source)
at com.xxxxxxxxx.xxxxxxxxxxx.Volley.VollyRequests$1.onResponse(Unknown Source)
at com.xxxxxxxxx.xxxxxxxxxxx.Volley.VollyRequests$1.onResponse(Unknown Source)
at com.android.volley.toolbox.StringRequest.deliverResponse(Unknown Source)
at com.android.volley.toolbox.StringRequest.onFinish(Unknown Source)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6343)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)