Simple fix if you're just using Bitmaps (gets trickier is you're
using, say, AnimationDrawable).

Try recycling each Bitmap you use:
http://developer.android.com/reference/android/graphics/Bitmap.html#recycle%28%29

On Jul 5, 1:03 pm, "[email protected]" <[email protected]>
wrote:
> HI ,
>
> While performing scrolling on the Bluetooth scanned devices screen I
> faced the below out of memory issue.
>
> 06-28 12:35:51.338 E/AndroidRuntime( 1311): Caused by:
> java.lang.OutOfMemoryError: bitmap size exceeds VM budget
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:
> 323)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.graphics.drawable.NinePatchDrawable.inflate(NinePatchDrawable.java:
> 254)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:
> 788)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.content.res.Resources.loadDrawable(Resources.java:1690)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.content.res.TypedArray.getDrawable(TypedArray.java:548)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.view.View.<init>(View.java:1850)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.view.View.<init>(View.java:1799)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     at
> android.view.ViewGroup.<init>(ViewGroup.java:284)
> 06-28 12:35:51.338 E/AndroidRuntime( 1311):     ... 36 more
>
> It looks like the memory for the application was exhausted .The
> bluetooth settings page uses BluetoothDevicePreference to handle
> onBindView() api for showing the the icon and name of the searched
> bluetooth devices , now while scrolling the searched device page every
> time the getView of the preference is getting called and that is
> eventually calling the onBindView() api to show the icon and device
> name on the screen.
>
> So can anyone suggest me how should I handle this kind of out of
> memory issue ?
>
> Thanks and Regards,
> Sourabh.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to