我正在尝试从网络打开一个巨大的图像,当我尝试加载图像时,第二个项目...我收到以下错误。
@Override
protected void onPostExecute(String result) {
progress.dismiss();
try {
JSONObject documentRoot = new JSONObject(result);
String data = documentRoot.getString("Data");
if (data.length() < 10) {
Toast.makeText(Activity.this, "This is not a valid document", Toast.LENGTH_SHORT).show();
finish();
} else
openPDF(data);
} catch (Exception e) {
Toast.makeText(Activity.this, "Document could not be opened", Toast.LENGTH_SHORT).show();
finish();
}
}
我在JSONObject documentRoot = new JSONObject(result);
这一行遇到错误。
06-14 19:54:22.218: E/XXX(16949): Uncaught exception is: 06-14
19:54:22.218: E/XXX(16949): java.lang.OutOfMemoryError 06-14 19:54:22.218: E/XXX(16949): at
java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94)
06-14 19:54:22.218: E/XXX(16949): at
java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:162)
06-14 19:54:22.218: E/XXX(16949): at
java.lang.StringBuilder.append(StringBuilder.java:311) 06-14
19:54:22.218: E/XXX(16949): at
org.json.JSONTokener.nextString(JSONTokener.java:224) 06-14
19:54:22.218: E/XXX(16949): at
org.json.JSONTokener.nextValue(JSONTokener.java:107) 06-14
19:54:22.218: E/XXX(16949): at
org.json.JSONTokener.readObject(JSONTokener.java:385) 06-14
19:54:22.218: E/XXX(16949): at
org.json.JSONTokener.nextValue(JSONTokener.java:100) 06-14
19:54:22.218: E/XXX(16949): at
org.json.JSONObject.<init>(JSONObject.java:154) 06-14 19:54:22.218:
E/XXX(16949): at org.json.JSONObject.<init>(JSONObject.java:171)
06-14 19:54:22.218: E/XXX(16949): at
com.patient.Activity$DocumentsShowAsyncTask.onPostExecute(DocumentViewerActivity2.java:273)
06-14 19:54:22.218: E/XXX(16949): at
com.patient.Activity$DocumentsShowAsyncTask.onPostExecute(DocumentViewerActivity2.java:1)
06-14 19:54:22.218: E/XXX(16949): at
android.os.AsyncTask.finish(AsyncTask.java:631) 06-14 19:54:22.218:
E/XXX(16949): at
android.os.AsyncTask.access$600(AsyncTask.java:177) 06-14
19:54:22.218: E/XXX(16949): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
06-14 19:54:22.218: E/XXX(16949): at
android.os.Handler.dispatchMessage(Handler.java:99) 06-14
19:54:22.218: E/XXX(16949): at
android.os.Looper.loop(Looper.java:137) 06-14 19:54:22.218:
E/XXX(16949): at
android.app.ActivityThread.main(ActivityThread.java:4928) 06-14
19:54:22.218: E/XXX(16949): at
java.lang.reflect.Method.invokeNative(Native Method) 06-14
19:54:22.218: E/XXX(16949): at
java.lang.reflect.Method.invoke(Method.java:511) 06-14 19:54:22.218:
E/XXX(16949): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
06-14 19:54:22.218: E/XXX(16949): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558) 06-14
19:54:22.218: E/XXX(16949): at
dalvik.system.NativeStart.main(Native Method)