Reclaim the ImageView after bitmap and the callback method before the activity is killed
1. Reclaim the ImageView after bitmap
1.11
ImageView imageView1 = (ImageView) findViewById (R. id. imageView1 );
Bitmap = BitmapFactory. decodeResource (getResources (), R. drawable. ic_launcher );
ImageView1.setImageBitmap (bitmap );
Bitmap. recycle ();
The content displayed in imageView1 is null.
1.12
ImageView imageView1 = (ImageView) findViewById (R. id. imageView1 );
Bitmap = BitmapFactory. decodeResource (getResources (), R. drawable. ic_launcher );
ImageView1.setImageBitmap (bitmap );
ImageView1.setOnClickListener (new OnClickListener (){
@ Override
Public void onClick (View v ){
StartActivity (new Intent (MainActivity. this, TwoActivity. class ));
}
});
@ Override
Protected void onStop (){
Super. onStop ();
System. out. println ("onStop ");
Bitmap. recycle ();
}
When the current activity is visible again, the content displayed in imageView1 is blank ........................, but no exception is thrown.
2. Callback method before activity death
2.11 The Methods triggered when you press the backend key include onBackPressed, onPause, onStop, and onDestroy.
2.12 The Methods triggered when the user finishes () the activity include: onPause, onStop, onDestroy