我正在创建一个应用程序,它将图像和存储捕获到内部存储以及ActiveAndroid中的本地存储。在开始时,我遇到了许多关于OutofMemory错误的问题。但是我通过here之后处理和压缩图像来解决这个错误。但是现在当我从ActiveAndroid应用程序中获取列表时,某些设备崩溃了,并且出现了内存错误。 下面是我的代码和错误响应。
在后台服务中我得到的列表如下:
List<ImageUploadModel> imagesList = ImageUploadModel.getUnUploadedImageListonintimation(uploadImageModel.getIntimationId());
在有效的Android中,我的查询
public static List<ImageUploadModel> getUnUploadedImageListonintimation(String IntimationId) {
return new Select().from(ImageUploadModel.class).where("intimationId=?", IntimationId).where("isImageDetailsUpload=?", false).execute();
}
我收到错误
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)