So i was having this error after some rotations were made. After this i
used the onDestroy method do get rid of drawables:
@Override
protected void onDestroy() {
super.onDestroy();
*unbindDrawables*(findViewById(android.R.id.content).getRootView());
System.gc();
Runtime.getRuntime().gc();
}
private void *unbindDrawables*(View view) {
if (view.getBackground() != null) {
view.getBackground().setCallback(null);
}
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
try {
((ViewGroup) view).removeAllViews();
}catch(UnsupportedOperationException mayHappen){
}
}
After implemeting this, i still got the errors on the more advanced phones
like the Nexus S and Galaxy Nexus, so i thought about the background image
that is being referenced in the style xml:
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">70dp</item>
<item name="android:windowBackground">@drawable/background_screen</item>
<item
name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
after removing the reference in the style tag, i got rid of the errors, so
i tried to add the image in the layout xml file instead to test it, and it
still worked, so i assume the problem is the *unbindDrawables *method
doesnt remove the background image because its reference is being made in
the theme, so is there a way to deal with this with another approach??can i
unbind the theme altogether? setTheme(0) didnt work either...
regards,
--
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