callback method of imageview,activity before recovering bitmap

Source: Internet
Author: User

1. ImageView after recovery of bitmap

1.11

ImageView imageView1 = (ImageView) Findviewbyid (R.ID.IMAGEVIEW1);
Bitmap = Bitmapfactory.decoderesource (Getresources (), r.drawable.ic_launcher);
Imageview1.setimagebitmap (bitmap);
Bitmap.recycle ();

The contents of the ImageView1 display are empty ..., but not the exception of the ..., but not the exceptions.

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 activity is now visible, the contents of the ImageView1 display are empty ..., but not the exception of the time of the day.

2.activity Pre-Death callback method

2.11 When the user presses the Back button, the method of triggering is = "Onbackpressed,onpause,onstop,ondestroy

2.12 User Finish () The method triggered by the activity is =>onpause,onstop,ondestroy


Callback method for imageview,activity before bitmap is recycled

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.