Note that there are some explanatory texts on larger screens.

plurals
  1. POOutOfMemoryError generated by use of bitmap images
    text
    copied!<p>I have an activity in my Android app that is trying to use 17 images as bitmap. However when I try to start this activity it returns <code>java.lang.OutOfMemoryError</code>. I really cannot solve this problem. Could anybody who has an exact solution me? My <code>onCreate()</code> is below. Thank you.</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.seviyor); activityHead=(ImageView) findViewById(R.id.activityhead1); shake = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); Options options=new Options(); options.inSampleSize=1; for(int i=0;i&lt;17;i++){ bmImages[i]=BitmapFactory.decodeResource(getResources(),drwbles[i] , options); } initilizeToastBackground(); initilizeButtonsFor16Leafs(); initilize16Lisener(); resultIntent=new Intent(this,ResultFrame.class); fortuneCon=16; for(int i=0;i&lt;17;i++){ leafs[i]=(ImageView) findViewById(leafIDs[i]); } for(int i=0;i&lt;17;i++){ leafs[i].setImageBitmap(bmImages[i]); } Bundle frompreviousInent=getIntent().getExtras(); categoryName=frompreviousInent.getString("category"); setHeadOfActivity(); } </code></pre> <p>And this is my LogCat...</p> <pre><code> 07-12 15:21:11.465: E/AndroidRuntime(23419): FATAL EXCEPTION: main 07-12 15:21:11.465: E/AndroidRuntime(23419): java.lang.OutOfMemoryError 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.Bitmap.nativeCreate(Native Method) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.Bitmap.createBitmap(Bitmap.java:605) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.Bitmap.createBitmap(Bitmap.java:551) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468) 07-12 15:21:11.465: E/AndroidRuntime(23419): at com.done.SS.onCreate(SS.java:65) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.Activity.performCreate(Activity.java:4562) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.ActivityThread.access$600(ActivityThread.java:128) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.os.Handler.dispatchMessage(Handler.java:99) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.os.Looper.loop(Looper.java:137) 07-12 15:21:11.465: E/AndroidRuntime(23419): at android.app.ActivityThread.main(ActivityThread.java:4514) 07-12 15:21:11.465: E/AndroidRuntime(23419): at java.lang.reflect.Method.invokeNative(Native Method) 07-12 15:21:11.465: E/AndroidRuntime(23419): at java.lang.reflect.Method.invoke(Method.java:511) 07-12 15:21:11.465: E/AndroidRuntime(23419): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993) 07-12 15:21:11.465: E/AndroidRuntime(23419): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760) 07-12 15:21:11.465: E/AndroidRuntime(23419): at dalvik.system.NativeStart.main(Native Method) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload