on my person name device i get an error caused by out of memory but when i tried the same program on another device it seems to work just fine
05-14 21:52:54.625: I/dalvikvm(3561): Wrote stack traces to '/data/anr/traces.txt'
05-14 21:52:55.135: I/dalvikvm(3561): threadid=3: reacting to signal 3
05-14 21:52:55.135: I/dalvikvm(3561): Wrote stack traces to '/data/anr/traces.txt'
05-14 21:52:56.785: D/dalvikvm(3561): GC_FOR_ALLOC freed 10K, 3% free 9663K/9863K, paused 13ms
05-14 21:52:56.785: I/dalvikvm-heap(3561): Grow heap (frag case) to 10.158MB for 633616-byte allocation
05-14 21:52:56.820: D/dalvikvm(3561): GC_CONCURRENT freed 3K, 3% free 10278K/10503K, paused 1ms+1ms
05-14 21:52:56.845: D/dalvikvm(3561): GC_FOR_ALLOC freed <1K, 3% free 10280K/10503K, paused 10ms
05-14 21:52:56.850: I/dalvikvm-heap(3561): Grow heap (frag case) to 10.759MB for 633616-byte allocation
05-14 21:52:56.885: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 3% free 10898K/11143K, paused 2ms+2ms
05-14 21:52:56.910: D/dalvikvm(3561): GC_FOR_ALLOC freed <1K, 3% free 10899K/11143K, paused 13ms
05-14 21:52:56.910: I/dalvikvm-heap(3561): Grow heap (frag case) to 11.365MB for 633616-byte allocation
05-14 21:52:56.935: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 3% free 11518K/11783K, paused 1ms+1ms
05-14 21:53:04.005: D/dalvikvm(3561): GC_FOR_ALLOC freed 13K, 2% free 11708K/11847K, paused 24ms
05-14 21:53:04.055: D/dalvikvm(3561): GC_CONCURRENT freed 419K, 5% free 12089K/12679K, paused 1ms+2ms
05-14 21:53:04.080: D/dalvikvm(3561): GC_FOR_ALLOC freed 0K, 5% free 12089K/12679K, paused 9ms
05-14 21:53:04.080: I/dalvikvm-heap(3561): Grow heap (frag case) to 13.680MB for 1843216-byte allocation
05-14 21:53:04.105: D/dalvikvm(3561): GC_CONCURRENT freed 0K, 5% free 13889K/14535K, paused 1ms+1ms
05-14 21:53:04.150: D/dalvikvm(3561): GC_FOR_ALLOC freed 800K, 10% free 13891K/15367K, paused 9ms
05-14 21:53:04.155: I/dalvikvm-heap(3561): Grow heap (frag case) to 15.440MB for 1843216-byte allocation
05-14 21:53:04.175: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 9% free 15691K/17223K, paused 1ms+2ms
05-14 21:53:05.370: E/AndroidRuntime(3561): at dalvik.system.NativeStart.main(Native Method)
05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: android.view.InflateException: Binary XML file line #158: Error inflating class <unknown>
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
05-14 21:53:05.370: E/AndroidRuntime(3561): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-14 21:53:05.370: E/AndroidRuntime(3561): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Activity.setContentView(Activity.java:1835)
05-14 21:53:05.370: E/AndroidRuntime(3561): at pilestudios.dirtyyou.singleplay.onCreate(singleplay.java:23)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Activity.performCreate(Activity.java:4465)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-14 21:53:05.370: E/AndroidRuntime(3561): ... 11 more
05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: java.lang.reflect.InvocationTargetException
05-14 21:53:05.370: E/AndroidRuntime(3561): at java.lang.reflect.Constructor.constructNative(Native Method)
05-14 21:53:05.370: E/AndroidRuntime(3561): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
05-14 21:53:05.370: E/AndroidRuntime(3561): ... 26 more
05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: java.lang.OutOfMemoryError
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.nativeCreate(Native Method)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.content.res.Resources.loadDrawable(Resources.java:1966)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.widget.ImageView.<init>(ImageView.java:119)
05-14 21:53:05.370: E/AndroidRuntime(3561): at android.widget.ImageView.<init>(ImageView.java:109)
Different devices have different heap sizes.
You can try scaling down your image to see if it helps.
Related
Google Play service to existing projects after adding the library project does not work. As it gives an error.
08-19 12:53:52.863: E/Trace(1977): error opening trace file: No such file or directory (2)
08-19 12:53:52.883: D/dalvikvm(1977): GC_FOR_ALLOC freed 80K, 2% free 10809K/11011K, paused 2ms, total 9ms
08-19 12:53:52.883: I/dalvikvm-heap(1977): Grow heap (frag case) to 12.922MB for 2457612-byte allocation
08-19 12:53:52.895: D/dalvikvm(1977): GC_CONCURRENT freed <1K, 2% free 13209K/13447K, paused 10ms+0ms, total 12ms
08-19 12:53:52.947: D/AndroidRuntime(1977): Shutting down VM
08-19 12:53:52.947: W/dalvikvm(1977): threadid=1: thread exiting with uncaught exception (group=0xa62be288)
08-19 12:53:52.947: E/AndroidRuntime(1977): FATAL EXCEPTION: main
08-19 12:53:52.947: E/AndroidRuntime(1977): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iloveyou.lovetester/com.iloveyou.lovetester.LoveTestActivity}: android.view.InflateException: Binary XML file line #85: Error inflating class com.google.ads.AdView
08-19 12:53:52.947: E/AndroidRuntime(1977): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-19 12:53:52.947: E/AndroidRuntime(1977): at
08-07 11:18:38.353: D/dalvikvm(15215): GC_FOR_ALLOC freed 83K, 6% free 12813K/13599K, paused 21ms
08-07 11:18:38.363: I/dalvikvm-heap(15215): Grow heap (frag case) to 15.352MB for 2908176-byte allocation
08-07 11:18:38.393: D/dalvikvm(15215): GC_FOR_ALLOC freed 1K, 6% free 15652K/16483K, paused 12ms
08-07 11:18:38.413: D/dalvikvm(15215): GC_CONCURRENT freed <1K, 6% free 15652K/16483K, paused 2ms+2ms
08-07 11:18:38.443: D/dalvikvm(15215): GC_FOR_ALLOC freed <1K, 6% free 15652K/16483K, paused 15ms
08-07 11:18:38.443: I/dalvikvm-heap(15215): Grow heap (frag case) to 20.281MB for 5169196-byte allocation
08-07 11:18:38.463: D/dalvikvm(15215): GC_FOR_ALLOC freed 0K, 4% free 20700K/21539K, paused 13ms
08-07 11:18:38.483: D/dalvikvm(15215): GC_CONCURRENT freed <1K, 4% free 20700K/21539K, paused 2ms+2ms
08-07 11:18:38.543: D/AndroidRuntime(15215): Shutting down VM
08-07 11:18:38.543: W/dalvikvm(15215): threadid=1: thread exiting with uncaught exception (group=0x40ab2210)
08-07 11:18:38.553: E/AndroidRuntime(15215): FATAL EXCEPTION: main
08-07 11:18:38.553: E/AndroidRuntime(15215): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demo/com.example.demo.MainActivity}: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.access$600(ActivityThread.java:127)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.os.Looper.loop(Looper.java:137)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.main(ActivityThread.java:4441)
08-07 11:18:38.553: E/AndroidRuntime(15215): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 11:18:38.553: E/AndroidRuntime(15215): at java.lang.reflect.Method.invoke(Method.java:511)
08-07 11:18:38.553: E/AndroidRuntime(15215): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
08-07 11:18:38.553: E/AndroidRuntime(15215): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
08-07 11:18:38.553: E/AndroidRuntime(15215): at dalvik.system.NativeStart.main(Native Method)
08-07 11:18:38.553: E/AndroidRuntime(15215): Caused by: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
08-07 11:18:38.553: E/AndroidRuntime(15215): at com.example.demo.MainActivity.onCreate(MainActivity.java:16)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.Activity.performCreate(Activity.java:4465)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
i can run simple graphical-layout but whe i try to add some code onclick or any other its show me these errors. i deleted api 20 from sdk manager and trying to compile in api17. HOW TO SOLVE THESE ERRORS??????
this exception says that you was cast ImageView to Button .
Caused by: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
Please change (Button) To (ImageView) at Line No 16 in MainActivity.java
In my Activity I have the following code:
int picture = Const.a1;
Const.backgroundBitmap = BitmapFactory.decodeResource(getResources(), picture);
Const.backgroundBitmapBonus0 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[0]);
Const.backgroundBitmapBonus1 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[1]);
Const.backgroundBitmapBonus2 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[2]);
Const.backgroundBitmapBonus3 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[3]);
Const.bitmapBackBonus = new Bitmap[4];
Const.bitmapBackBonus[0]= Const.backgroundBitmapBonus0;
Const.bitmapBackBonus[1] = Const.backgroundBitmapBonus1;
Const.bitmapBackBonus[2] = Const.backgroundBitmapBonus2;
Const.bitmapBackBonus[3] = Const.backgroundBitmapBonus3;
And in Const class I have
public static int[] bonus_back = { R.drawable.back_b0 , R.drawable.back_b1 , R.drawable.back_b2 , R.drawable.back_b3};
When I run the app on my device it crashes, while in AVD it worked fine.
How can I use these pictures in right way?
EDIT:
new code using http://developer.android.com/training/displaying-bitmaps/load-bitmap.html
still the same problem
Const.screenWidth = this.getWindowManager().getDefaultDisplay().getWidth();
Const.screenHeight = this.getWindowManager().getDefaultDisplay().getHeight();
int picture = Const.a1;
Const.backgroundBitmapBonus0 = decodeSampledBitmapFromResource(getResources(), Const.bonus_back[0], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmapBonus1 =decodeSampledBitmapFromResource(getResources(), Const.bonus_back[1], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmapBonus2 = decodeSampledBitmapFromResource(getResources(), Const.bonus_back[2], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmapBonus3 = decodeSampledBitmapFromResource(getResources(), Const.bonus_back[3], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmap = decodeSampledBitmapFromResource(getResources(), picture, 100, 100);
/*Const.backgroundBitmap = BitmapFactory.decodeResource(getResources(), picture);
Const.backgroundBitmapBonus0 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[0]);
Const.backgroundBitmapBonus1 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[1]);
Const.backgroundBitmapBonus2 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[2]);
Const.backgroundBitmapBonus3 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[3]);
*/
Const.bitmapBackBonus = new Bitmap[4];
Const.bitmapBackBonus[0]= Const.backgroundBitmapBonus0;
Const.bitmapBackBonus[1] = Const.backgroundBitmapBonus1;
Const.bitmapBackBonus[2] = Const.backgroundBitmapBonus2;
Const.bitmapBackBonus[3] = Const.backgroundBitmapBonus3;
EDIT 2 : Logcat
11-14 09:45:45.525: D/dalvikvm(5623): Late-enabling CheckJNI
11-14 09:45:45.805: D/skia(5623): ---- fAsset->read(3346) returned 0
11-14 09:45:45.905: D/dalvikvm(5623): GC_FOR_ALLOC freed 99K, 3% free 13923K/14343K, paused 37ms
11-14 09:45:45.905: I/dalvikvm-heap(5623): Grow heap (frag case) to 14.807MB for 992016-byte allocation
11-14 09:45:45.945: D/dalvikvm(5623): GC_CONCURRENT freed 1K, 4% free 14890K/15367K, paused 2ms+2ms
11-14 09:45:46.025: D/dalvikvm(5623): GC_FOR_ALLOC freed 0K, 4% free 14890K/15367K, paused 13ms
11-14 09:45:46.075: I/dalvikvm-heap(5623): Grow heap (frag case) to 29.942MB for 15872016-byte allocation
11-14 09:45:46.115: D/dalvikvm(5623): GC_CONCURRENT freed 0K, 2% free 30390K/30919K, paused 2ms+2ms
11-14 09:45:46.515: D/dalvikvm(5623): GC_FOR_ALLOC freed 969K, 5% free 30391K/31943K, paused 18ms
11-14 09:45:46.565: I/dalvikvm-heap(5623): Grow heap (frag case) to 45.080MB for 15872016-byte allocation
11-14 09:45:46.595: D/dalvikvm(5623): GC_CONCURRENT freed <1K, 4% free 45890K/47495K, paused 2ms+3ms
11-14 09:45:46.905: D/dalvikvm(5623): GC_FOR_ALLOC freed 969K, 4% free 45891K/47495K, paused 15ms
11-14 09:45:46.970: I/dalvikvm-heap(5623): Grow heap (frag case) to 60.216MB for 15872016-byte allocation
11-14 09:45:46.990: D/dalvikvm(5623): GC_FOR_ALLOC freed <1K, 3% free 61391K/63047K, paused 18ms
11-14 09:45:47.050: D/dalvikvm(5623): GC_CONCURRENT freed 0K, 3% free 61391K/63047K, paused 2ms+5ms
11-14 09:45:47.345: D/dalvikvm(5623): GC_FOR_ALLOC freed 969K, 3% free 61391K/63047K, paused 14ms
11-14 09:45:47.345: I/dalvikvm-heap(5623): Forcing collection of SoftReferences for 15872016-byte allocation
11-14 09:45:47.390: D/dalvikvm(5623): GC_BEFORE_OOM freed 9K, 3% free 61382K/63047K, paused 32ms
11-14 09:45:47.390: E/dalvikvm-heap(5623): Out of memory on a 15872016-byte allocation.
11-14 09:45:47.390: I/dalvikvm(5623): "main" prio=5 tid=1 RUNNABLE
11-14 09:45:47.390: I/dalvikvm(5623): | group="main" sCount=0 dsCount=0 obj=0x40c6d460 self=0x8a9288
11-14 09:45:47.390: I/dalvikvm(5623): | sysTid=5623 nice=0 sched=0/0 cgrp=default handle=1074558216
11-14 09:45:47.390: I/dalvikvm(5623): | schedstat=( 1288354466 258529951 3812 ) utm=106 stm=22 core=2
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.nativeCreate(Native Method)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468)
11-14 09:45:47.390: I/dalvikvm(5623): at com.example.fishe.FullscreenActivity.decodeSampledBitmapFromResource(FullscreenActivity.java:248)
11-14 09:45:47.390: I/dalvikvm(5623): at com.example.fishe.FullscreenActivity.onCreate(FullscreenActivity.java:142)
11-14 09:45:47.390: I/dalvikvm(5623): at android.app.Activity.performCreate(Activity.java:4533)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.access$600(ActivityThread.java:128)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
11-14 09:45:47.395: I/dalvikvm(5623): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 09:45:47.395: I/dalvikvm(5623): at android.os.Looper.loop(Looper.java:137)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.main(ActivityThread.java:4517)
11-14 09:45:47.395: I/dalvikvm(5623): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 09:45:47.395: I/dalvikvm(5623): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 09:45:47.395: I/dalvikvm(5623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
11-14 09:45:47.395: I/dalvikvm(5623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
11-14 09:45:47.395: I/dalvikvm(5623): at dalvik.system.NativeStart.main(Native Method)
11-14 09:45:47.395: D/AndroidRuntime(5623): Shutting down VM
11-14 09:45:47.395: W/dalvikvm(5623): threadid=1: thread exiting with uncaught exception (group=0x40c6c1f8)
11-14 09:45:47.395: E/AndroidRuntime(5623): FATAL EXCEPTION: main
11-14 09:45:47.395: E/AndroidRuntime(5623): java.lang.OutOfMemoryError
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.nativeCreate(Native Method)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.example.fishe.FullscreenActivity.decodeSampledBitmapFromResource(FullscreenActivity.java:248)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.example.fishe.FullscreenActivity.onCreate(FullscreenActivity.java:142)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.Activity.performCreate(Activity.java:4533)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.access$600(ActivityThread.java:128)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.os.Looper.loop(Looper.java:137)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.main(ActivityThread.java:4517)
11-14 09:45:47.395: E/AndroidRuntime(5623): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 09:45:47.395: E/AndroidRuntime(5623): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
11-14 09:45:47.395: E/AndroidRuntime(5623): at dalvik.system.NativeStart.main(Native Method)
11-14 09:45:56.490: I/Process(5623): Sending signal. PID: 5623 SIG: 9
If the image is too big you're probably running out of memory.
Check http://developer.android.com/training/displaying-bitmaps/load-bitmap.html to learn how to load a scaled-down version of the image.
I'm writing an Android app. It has two pages. The second page is supposed to be a page full of image buttons. But when I run my app in the emulator and go to the second page, the page is not displayed. Why?
Here's an error I get:
Android logcat Text :Fatal signal 11(SIGSEGV) at 0X00000000 (code==1) ,thread 614(com.s
THIS IS THE ENTIRE LOGCAT
: D/gralloc_goldfish(614): Emulator without GPU emulation detected.
01-14 09:08:14.554: D/dalvikvm(614): GC_FOR_ALLOC freed 89K, 3% free 8141K/8327K, paused 33ms, total 35ms
01-14 09:08:14.584: I/dalvikvm-heap(614): Grow heap (frag case) to 10.998MB for 3145744-byte allocation
01-14 09:08:14.744: D/dalvikvm(614): GC_CONCURRENT freed 4K, 3% free 11209K/11463K, paused 105ms+15ms, total 160ms
01-14 09:08:15.054: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 3% free 11209K/11463K, paused 22ms, total 22ms
01-14 09:08:15.104: I/dalvikvm-heap(614): Grow heap (frag case) to 17.744MB for 7077904-byte allocation
01-14 09:08:15.254: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 18121K/18439K, paused 97ms+6ms, total 157ms
01-14 09:08:15.424: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 19% free 15050K/18439K, paused 27ms, total 27ms
01-14 09:08:15.424: I/dalvikvm-heap(614): Grow heap (frag case) to 17.745MB for 3145744-byte allocation
01-14 09:08:15.574: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 18122K/18439K, paused 102ms+15ms, total 149ms
01-14 09:08:15.904: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 18122K/18439K, paused 27ms, total 27ms
01-14 09:08:15.954: I/dalvikvm-heap(614): Grow heap (frag case) to 24.495MB for 7077904-byte allocation
01-14 09:08:16.094: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 25034K/25415K, paused 76ms+6ms, total 140ms
01-14 09:08:16.304: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 14% free 21964K/25415K, paused 32ms, total 33ms
01-14 09:08:16.314: I/dalvikvm-heap(614): Grow heap (frag case) to 24.498MB for 3145744-byte allocation
01-14 09:08:16.484: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 25036K/25415K, paused 109ms+16ms, total 170ms
01-14 09:08:16.764: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 25036K/25415K, paused 30ms, total 30ms
01-14 09:08:16.814: I/dalvikvm-heap(614): Grow heap (frag case) to 31.248MB for 7077904-byte allocation
01-14 09:08:16.994: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 31948K/32391K, paused 99ms+7ms, total 180ms
01-14 09:08:17.145: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 11% free 28878K/32391K, paused 37ms, total 37ms
01-14 09:08:17.154: I/dalvikvm-heap(614): Grow heap (frag case) to 31.249MB for 3145744-byte allocation
01-14 09:08:17.314: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 31950K/32391K, paused 82ms+18ms, total 161ms
01-14 09:08:17.624: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 31950K/32391K, paused 41ms, total 41ms
01-14 09:08:17.674: I/dalvikvm-heap(614): Grow heap (frag case) to 37.999MB for 7077904-byte allocation
01-14 09:08:17.874: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 38862K/39367K, paused 108ms+8ms, total 204ms
01-14 09:08:18.024: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 10% free 35791K/39367K, paused 41ms, total 42ms
01-14 09:08:18.024: I/dalvikvm-heap(614): Grow heap (frag case) to 38.000MB for 3145744-byte allocation
01-14 09:08:18.184: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 38863K/39367K, paused 73ms+20ms, total 157ms
01-14 09:08:18.514: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 38863K/39367K, paused 40ms, total 40ms
01-14 09:08:18.564: I/dalvikvm-heap(614): Grow heap (frag case) to 44.750MB for 7077904-byte allocation
01-14 09:08:18.794: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 45775K/46343K, paused 92ms+21ms, total 228ms
01-14 09:08:18.954: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 8% free 42704K/46343K, paused 43ms, total 44ms
01-14 09:08:18.954: I/dalvikvm-heap(614): Grow heap (frag case) to 44.751MB for 3145744-byte allocation
01-14 09:08:19.114: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 45776K/46343K, paused 74ms+7ms, total 162ms
01-14 09:08:19.445: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 45776K/46343K, paused 60ms, total 60ms
01-14 09:08:19.445: I/dalvikvm-heap(614): Forcing collection of SoftReferences for 7077904-byte allocation
01-14 09:08:19.875: D/dalvikvm(614): GC_BEFORE_OOM freed 9K, 2% free 45767K/46343K, paused 426ms, total 427ms
01-14 09:08:19.875: E/dalvikvm-heap(614): Out of memory on a 7077904-byte allocation.
01-14 09:08:19.875: I/dalvikvm(614): "main" prio=5 tid=1 RUNNABLE
01-14 09:08:19.875: I/dalvikvm(614): | group="main" sCount=0 dsCount=0 obj=0x40a14568 self=0x2a00b9e0
01-14 09:08:19.875: I/dalvikvm(614): | sysTid=614 nice=0 sched=0/0 cgrp=apps handle=1073870640
01-14 09:08:19.885: I/dalvikvm(614): | schedstat=( 3996873888 1969503221 492 ) utm=351 stm=48 core=0
01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
01-14 09:08:19.885: I/dalvikvm(614): at android.content.res.Resources.loadDrawable(Resources.java:1930)
01-14 09:08:19.885: I/dalvikvm(614): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
01-14 09:08:19.894: I/dalvikvm(614): at android.widget.ImageView.<init>(ImageView.java:120)
01-14 09:08:19.894: I/dalvikvm(614): at android.widget.ImageView.<init>(ImageView.java:110)
01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Constructor.constructNative(Native Method)
01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
01-14 09:08:19.904: I/dalvikvm(614): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-14 09:08:19.904: I/dalvikvm(614): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.Activity.setContentView(Activity.java:1867)
01-14 09:08:19.904: I/dalvikvm(614): at com.sgs.First.onCreate(First.java:13)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.Activity.performCreate(Activity.java:5008)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-14 09:08:19.904: I/dalvikvm(614): at android.os.Handler.dispatchMessage(Handler.java:99)
01-14 09:08:19.904: I/dalvikvm(614): at android.os.Looper.loop(Looper.java:137)
01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Method.invokeNative(Native Method)
01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Method.invoke(Method.java:511)
01-14 09:08:19.904: I/dalvikvm(614): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-14 09:08:19.914: I/dalvikvm(614): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-14 09:08:19.914: I/dalvikvm(614): at dalvik.system.NativeStart.main(Native Method)
01-14 09:08:19.930: A/libc(614): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 614 (com.sgs)
THIS IS THE XML CODE
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageButton1"
android:layout_width="160dp"
android:layout_height="100dp"
android:src="#drawable/c" />
<ImageView
android:id="#+id/imageButton2"
android:layout_width="160dp"
android:layout_height="100dp"
android:src="#drawable/d" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageButton3"
android:layout_width="80dp"
android:layout_height="300dp"
android:src="#drawable/e" />
<ImageView
android:id="#+id/imageButton4"
android:layout_width="160dp"
android:layout_height="300dp"
android:src="#drawable/g" />
<ImageView
android:id="#+id/imageButton5"
android:layout_width="80dp"
android:layout_height="300dp"
android:src="#drawable/f" />
</LinearLayout>
<ImageView
android:id="#+id/imageButton6"
android:layout_width="320dp"
android:layout_height="100dp"
android:src="#drawable/h" />
</LinearLayout>
THIS IS THE CORRESPONDING JAVA FILE
package com.sgs;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class First extends Activity implements OnClickListener {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.first);
ImageView image1 = (ImageView) findViewById(R.id.imageButton1);
ImageView image2 = (ImageView) findViewById(R.id.imageButton2);
ImageView image3 = (ImageView) findViewById(R.id.imageButton3);
ImageView image4 = (ImageView) findViewById(R.id.imageButton4);
ImageView image5 = (ImageView) findViewById(R.id.imageButton5);
image1.setOnClickListener(this);
image2.setOnClickListener(this);
image3.setOnClickListener(this);
image4.setOnClickListener(this);
image5.setOnClickListener(this);
}
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()){
case R.id.imageButton1:
}
}
}
From the log you can see an out of memory error when an image is beeing decoded:
01-14 09:08:19.875: E/dalvikvm-heap(614): Out of memory on a 7077904-byte allocation.
Maybe the images used (by mistake) are to large for the memory allocated by you emulator device profile. You could try increasing the heap size of the device (Window-->AVD Manager-->Virtual Devices-->Edit : Hardware properties)
here is my error log please help?
I am a newbie to android and this is my first app
package gaurav.rapp.swamiji;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ViewSwitcher.ViewFactory;
public class BeWithSwamijiActivity extends Activity implements ViewFactory {
Integer pics[]={R.drawable.img1,R.drawable.img2,R.drawable.img3,R.drawable.img4,R.drawable.img5,R.drawable.img6,R.drawable.img7,R.drawable.img8,R.drawable.img9,R.drawable.img10,R.drawable.img11,R.drawable.img12,R.drawable.img13,R.drawable.img14,R.drawable.img15,R.drawable.img16,R.drawable.img17};
ImageSwitcher iSwitcher;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
iSwitcher = (ImageSwitcher) findViewById(R.id.ImageSwitcher01);
iSwitcher.setFactory(this);
iSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
iSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
Gallery gallery = (Gallery) findViewById(R.id.Gallery01);
gallery.setAdapter(new ImageAdapter(this));
gallery.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
iSwitcher.setImageResource(pics[arg2]);
}
});
}
public class ImageAdapter extends BaseAdapter {
private Context ctx;
public ImageAdapter(Context c) {
ctx = c;
}
#Override
public int getCount() {
return pics.length;
}
#Override
public Object getItem(int arg0) {
return arg0;
}
#Override
public long getItemId(int arg0) {
return arg0;
}
#Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
ImageView iView = new ImageView(ctx);
iView.setImageResource(pics[arg0]);
iView.setScaleType(ImageView.ScaleType.FIT_XY);
iView.setLayoutParams(new Gallery.LayoutParams(150, 150));
return iView;
}
}
#Override
public View makeView() {
ImageView iView=new ImageView(this);
iView.setScaleType(ImageView.ScaleType.FIT_CENTER);
iView.setLayoutParams(new ImageSwitcher.LayoutParams(
LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
iView.setBackgroundColor(0xFF000000);
return iView;
}
}
Log
05-13 21:58:39.107: I/Process(397): Sending signal. PID: 397 SIG: 9
05-13 21:58:45.517: D/dalvikvm(409): GC_FOR_ALLOC freed 43K, 4% free 6362K/6595K, paused 75ms
05-13 21:58:45.587: I/dalvikvm-heap(409): Grow heap (frag case) to 10.624MB for 4566704-byte allocation
05-13 21:58:45.697: D/dalvikvm(409): GC_FOR_ALLOC freed 1K, 3% free 10820K/11079K, paused 86ms
05-13 21:58:45.887: D/dalvikvm(409): GC_CONCURRENT freed <1K, 3% free 10820K/11079K, paused 25ms+3ms
05-13 21:58:46.427: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 3% free 10820K/11079K, paused 112ms
05-13 21:58:46.547: I/dalvikvm-heap(409): Grow heap (frag case) to 18.362MB for 8114772-byte allocation
05-13 21:58:46.839: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 2% free 18745K/19015K, paused 72ms
05-13 21:58:47.057: D/dalvikvm(409): GC_CONCURRENT freed 0K, 2% free 18745K/19015K, paused 4ms+16ms
05-13 21:58:47.680: D/dalvikvm(409): GC_FOR_ALLOC freed 5051K, 26% free 15340K/20679K, paused 72ms
05-13 21:58:47.889: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 21% free 16537K/20679K, paused 71ms
05-13 21:58:47.889: I/dalvikvm-heap(409): Grow heap (frag case) to 18.284MB for 2179600-byte allocation
05-13 21:58:48.037: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 10% free 18666K/20679K, paused 75ms
05-13 21:58:48.307: D/dalvikvm(409): GC_CONCURRENT freed 0K, 10% free 18666K/20679K, paused 5ms+3ms
05-13 21:58:48.511: D/dalvikvm(409): GC_FOR_ALLOC freed 1197K, 11% free 18425K/20679K, paused 73ms
05-13 21:58:48.530: I/dalvikvm-heap(409): Grow heap (frag case) to 19.705MB for 1735988-byte allocation
05-13 21:58:48.681: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 11% free 20120K/22407K, paused 76ms
05-13 21:59:09.187: D/dalvikvm(409): GC_FOR_ALLOC freed 961K, 13% free 19660K/22407K, paused 75ms
05-13 21:59:11.737: D/dalvikvm(409): GC_FOR_ALLOC freed 678K, 10% free 20385K/22407K, paused 143ms
05-13 21:59:11.797: I/dalvikvm-heap(409): Grow heap (frag case) to 24.518MB for 4776976-byte allocation
05-13 21:59:11.971: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 8% free 25049K/27079K, paused 85ms
05-13 21:59:12.117: D/dalvikvm(409): GC_CONCURRENT freed <1K, 8% free 25049K/27079K, paused 4ms+3ms
05-13 21:59:12.327: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 8% free 25049K/27079K, paused 93ms
05-13 21:59:12.437: I/dalvikvm-heap(409): Grow heap (frag case) to 32.619MB for 8494048-byte allocation
05-13 21:59:12.589: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 6% free 33344K/35399K, paused 82ms
05-13 21:59:12.877: D/dalvikvm(409): GC_CONCURRENT freed 0K, 6% free 33345K/35399K, paused 5ms+4ms
05-13 21:59:29.208: D/dalvikvm(409): GC_FOR_ALLOC freed 4862K, 17% free 29383K/35399K, paused 84ms
05-13 21:59:31.130: D/dalvikvm(409): GC_FOR_ALLOC freed 353K, 13% free 30855K/35399K, paused 84ms
05-13 21:59:31.137: I/dalvikvm-heap(409): Grow heap (frag case) to 32.266MB for 2179600-byte allocation
05-13 21:59:31.287: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 7% free 32983K/35399K, paused 82ms
05-13 21:59:31.538: D/dalvikvm(409): GC_CONCURRENT freed 0K, 7% free 32983K/35399K, paused 5ms+4ms
05-13 21:59:31.647: D/dalvikvm(409): GC_FOR_ALLOC freed 1549K, 12% free 31435K/35399K, paused 92ms
05-13 21:59:31.692: I/dalvikvm-heap(409): Grow heap (frag case) to 33.028MB for 2384216-byte allocation
05-13 21:59:31.880: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 11% free 33764K/37767K, paused 100ms
05-13 21:59:32.057: D/dalvikvm(409): GC_CONCURRENT freed <1K, 11% free 33764K/37767K, paused 4ms+4ms
05-13 21:59:32.307: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 11% free 33764K/37767K, paused 108ms
05-13 21:59:32.377: I/dalvikvm-heap(409): Grow heap (frag case) to 37.073MB for 4241380-byte allocation
05-13 21:59:32.547: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 10% free 37906K/41927K, paused 97ms
05-13 21:59:32.797: D/dalvikvm(409): GC_CONCURRENT freed 0K, 10% free 37906K/41927K, paused 4ms+14ms
05-13 21:59:34.747: D/dalvikvm(409): GC_FOR_ALLOC freed 2329K, 13% free 36533K/41927K, paused 98ms
05-13 21:59:35.037: D/dalvikvm(409): GC_CONCURRENT freed 1304K, 12% free 37261K/41927K, paused 4ms+4ms
05-13 21:59:42.547: D/dalvikvm(409): GC_FOR_ALLOC freed 337K, 11% free 37524K/41927K, paused 88ms
05-13 21:59:42.607: I/dalvikvm-heap(409): Grow heap (frag case) to 41.255MB for 4776976-byte allocation
05-13 21:59:42.801: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 10% free 42188K/46599K, paused 104ms
05-13 21:59:43.021: D/dalvikvm(409): GC_CONCURRENT freed <1K, 10% free 42188K/46599K, paused 4ms+4ms
05-13 21:59:43.180: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 10% free 42189K/46599K, paused 98ms
05-13 21:59:43.180: I/dalvikvm-heap(409): Forcing collection of SoftReferences for 8494048-byte allocation
05-13 21:59:43.327: D/dalvikvm(409): GC_BEFORE_OOM freed 8K, 10% free 42180K/46599K, paused 143ms
05-13 21:59:43.327: E/dalvikvm-heap(409): Out of memory on a 8494048-byte allocation.
05-13 21:59:43.337: I/dalvikvm(409): "main" prio=5 tid=1 RUNNABLE
05-13 21:59:43.337: I/dalvikvm(409): | group="main" sCount=0 dsCount=0 obj=0x4001b5c8 self=0x125d8
05-13 21:59:43.337: I/dalvikvm(409): | sysTid=409 nice=0 sched=0/0 cgrp=default handle=-1342913432
05-13 21:59:43.337: I/dalvikvm(409): | schedstat=( 10690152881 5424008534 597 ) utm=864 stm=205 core=0
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.nativeCreate(Native Method)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
05-13 21:59:43.347: I/dalvikvm(409): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
05-13 21:59:43.347: I/dalvikvm(409): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
05-13 21:59:43.347: I/dalvikvm(409): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
05-13 21:59:43.347: I/dalvikvm(409): at android.content.res.Resources.loadDrawable(Resources.java:1918)
05-13 21:59:43.347: I/dalvikvm(409): at android.content.res.Resources.getDrawable(Resources.java:655)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.ImageView.resolveUri(ImageView.java:510)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.ImageView.setImageResource(ImageView.java:289)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.ImageSwitcher.setImageResource(ImageSwitcher.java:41)
05-13 21:59:43.357: I/dalvikvm(409): at gaurav.rapp.swamiji.BeWithSwamijiActivity$1.onItemClick(BeWithSwamijiActivity.java:39)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.AdapterView.performItemClick(AdapterView.java:282)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.Gallery.onSingleTapUp(Gallery.java:867)
05-13 21:59:43.357: I/dalvikvm(409): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:557)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.Gallery.onTouchEvent(Gallery.java:842)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.View.dispatchTouchEvent(View.java:4609)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
05-13 21:59:43.407: I/dalvikvm(409): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1264)
05-13 21:59:43.407: I/dalvikvm(409): at android.app.Activity.dispatchTouchEvent(Activity.java:2315)
05-13 21:59:43.407: I/dalvikvm(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
05-13 21:59:43.417: I/dalvikvm(409): at android.view.View.dispatchPointerEvent(View.java:4677)
05-13 21:59:43.417: I/dalvikvm(409): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
05-13 21:59:43.417: I/dalvikvm(409): at android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
05-13 21:59:43.417: I/dalvikvm(409): at android.os.Handler.dispatchMessage(Handler.java:99)
05-13 21:59:43.417: I/dalvikvm(409): at android.os.Looper.loop(Looper.java:132)
05-13 21:59:43.417: I/dalvikvm(409): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-13 21:59:43.417: I/dalvikvm(409): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 21:59:43.417: I/dalvikvm(409): at java.lang.reflect.Method.invoke(Method.java:491)
05-13 21:59:43.417: I/dalvikvm(409): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-13 21:59:43.417: I/dalvikvm(409): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-13 21:59:43.417: I/dalvikvm(409): at dalvik.system.NativeStart.main(Native Method)
05-13 21:59:43.417: D/AndroidRuntime(409): Shutting down VM
05-13 21:59:43.417: W/dalvikvm(409): threadid=1: thread exiting with uncaught exception (group=0x40014760)
05-13 21:59:43.467: E/AndroidRuntime(409): FATAL EXCEPTION: main
05-13 21:59:43.467: E/AndroidRuntime(409): java.lang.OutOfMemoryError
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.nativeCreate(Native Method)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.content.res.Resources.loadDrawable(Resources.java:1918)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.content.res.Resources.getDrawable(Resources.java:655)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.ImageView.resolveUri(ImageView.java:510)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.ImageView.setImageResource(ImageView.java:289)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.ImageSwitcher.setImageResource(ImageSwitcher.java:41)
05-13 21:59:43.467: E/AndroidRuntime(409): at gaurav.rapp.swamiji.BeWithSwamijiActivity$1.onItemClick(BeWithSwamijiActivity.java:39)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.AdapterView.performItemClick(AdapterView.java:282)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.Gallery.onSingleTapUp(Gallery.java:867)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:557)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.Gallery.onTouchEvent(Gallery.java:842)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.View.dispatchTouchEvent(View.java:4609)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1264)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.app.Activity.dispatchTouchEvent(Activity.java:2315)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.View.dispatchPointerEvent(View.java:4677)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.os.Handler.dispatchMessage(Handler.java:99)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.os.Looper.loop(Looper.java:132)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-13 21:59:43.467: E/AndroidRuntime(409): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 21:59:43.467: E/AndroidRuntime(409): at java.lang.reflect.Method.invoke(Method.java:491)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-13 21:59:43.467: E/AndroidRuntime(409): at dalvik.system.NativeStart.main(Native Method)
05-13 21:59:46.117: I/Process(409): Sending signal. PID: 409 SIG: 9
Out of memory on a 8494048-byte allocation.
Don't try to load 8MB bitmaps! Resize your assets to something more appropriate, or look at BitmapFactory.Options to downscale whatever it is you are trying to load.