I'm getting some reports from the remote stack trace plug-in, with
this error (see below)
What I'm doing, is
findViewById(R.id.instructionsBack).setBackgroundResource
(R.drawable.instructions1);
And then when I need to change the image,
findViewById(R.id.instructionsBack).setBackgroundResource
(R.drawable.instructions2);
>From the error, I'm guessing that the old image is staying in the
memory and preventing the new one from loading?
What's the correct way to do this kind of thing?
Thanks,
Richard
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:
363)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:
212)
at android.graphics.drawable.Drawable.createFromResourceStream
(Drawable.java:663)
at android.content.res.Resources.loadDrawable(Resources.java:1637)
at android.content.res.Resources.getDrawable(Resources.java:535)
at android.view.View.setBackgroundResource(View.java:6489)
at com.stickycoding.FlyingAces.Instructions.updateScreen
(Instructions.java:33)
at com.stickycoding.FlyingAces.Instructions.onClick(Instructions.java:
52)
at android.view.View.performClick(View.java:2179)
at android.view.View.onTouchEvent(View.java:3828)
at android.view.View.dispatchTouchEvent(View.java:3368)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:903)
at com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1752)
at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
(PhoneWindow.java:1206)
at android.app.Activity.dispatchTouchEvent(Activity.java:1998)
at com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1736)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1547)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---