This troubled me for a long time...
I have a login screen with a background image to be setup. For avoid memory leak, I use the guide and code from google: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html
And when it comes to jump to next activity, I put some recycle code into onPause of login activity to free the memory use of bitmap.
protected void onPause() {
super.onPause();
BitmapDrawable bd = (BitmapDrawable)background.getBackground();
background.setBackgroundResource(0);
bd.setCallback(null);
bd.getBitmap().recycle();
}
This code doesn't create any error and from DDMS the bitmap is been freed.
But before the login screen disappear completely, it will be one second or two that the background is black. Other components of login screen are not gone yet, but the background will be gone first and left an ugly black...
Is there a way to solve this smoothly? Thank you!