1

Can someone help me to figure out what wrong with my app: ive tried for the past 3 days to figure out what it is but no luck also why is gallery deprecated ....what do i use instead is this why my app is force closing if u need my .java code let me know thanks HELP here Logcat

06-05 16:50:33.234: D/skia(19241): --- allocation failed for scaled bitmap
06-05 16:50:33.234: D/AndroidRuntime(19241): Shutting down VM
06-05 16:50:33.241: W/dalvikvm(19241): threadid=1: thread exiting with uncaught     exception (group=0x40bdda08)
06-05 16:50:33.241: E/AndroidRuntime(19241): FATAL EXCEPTION: main
06-05 16:50:33.241: E/AndroidRuntime(19241): java.lang.OutOfMemoryError
06-05 16:50:33.241: E/AndroidRuntime(19241):    at     android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:786)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.content.res.Resources.loadDrawable(Resources.java:2013)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at     android.content.res.Resources.getDrawable(Resources.java:680)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.ImageView.resolveUri(ImageView.java:616)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.ImageView.setImageResource(ImageView.java:349)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.istyleevents.ImageAdapter.getView(ImageAdapter.java:45)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:193)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at   android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at  android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.View.measure(View.java:15518)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer.doFrame(Choreographer.java:532)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.os.Handler.handleCallback(Handler.java:725)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.os.Handler.dispatchMessage(Handler.java:92)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.os.Looper.loop(Looper.java:137)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at android.app.ActivityThread.main(ActivityThread.java:5229)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at java.lang.reflect.Method.invokeNative(Native Method)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at java.lang.reflect.Method.invoke(Method.java:525)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
06-05 16:50:33.241: E/AndroidRuntime(19241):    at dalvik.system.NativeStart.main(Native Method)
06-05 16:50:35.585: I/Process(19241): Sending signal. PID: 19241 SIG: 9
x iHarpzZ
  • 151
  • 3
  • 16
  • 1
    http://stackoverflow.com/questions/16765899/out-of-memory-error-with-bitmap/16766123#16766123. similar question – Raghunandan Jun 05 '13 at 16:05
  • if i reduce the size of my image will it be fine?.....im so confused sorry – x iHarpzZ Jun 05 '13 at 16:11
  • if you run out of memory you should scale down. i have used the same in many of my apps.http://developer.android.com/training/displaying-bitmaps/load-bitmap.html – Raghunandan Jun 05 '13 at 16:11
  • omg i reduced the size of my images and it worked. but they are displayed so small in the app. what the easier way fro my to increase the said allocated? ..thanks evryone – x iHarpzZ Jun 05 '13 at 16:30
  • you can scale the image to the require height and width using the codes in the link. – Raghunandan Jun 05 '13 at 16:31
  • public static Bitmap decodeFile(File f,int WIDTH,int HIGHT). mention the required height and width of the image you need – Raghunandan Jun 05 '13 at 16:32

2 Answers2

0

OutOfMemoryError. You application is filling the memory of the device. Maybe this is happening:

  • Your app intentionally allocates tons of data (images) in memory for some reason without controlling amount of memory that the device has free.
  • Your app don't deallocates previous allocated data that is not used anymore (Opening an image and not freeing the memory when closing it).
  • Some other types of memory leaks.

You should read about memory leaks. Here a bit of info: http://android-developers.blogspot.com.es/2009/01/avoiding-memory-leaks.html

Also, maybe the image is too big. You must resize it before loading it.

Jorge Fuentes González
  • 11,568
  • 4
  • 44
  • 64
0

If testing on emulator, try increasing the size of VM heap of your AVD, by editing it from AVD manager.

Chintan Soni
  • 24,761
  • 25
  • 106
  • 174