ImageView and Bitmap conversion. For example, set the current image to the desktop background,
ImageView to Bitmap
Bitmap bitmap = (BitmapDrawable) img. getDrawable (). getBitmap ();
Bitmap bitmap = (BitmapDrawable) img. getDrawable (). getBitmap ();
@ Overridepublic boolean onLongClick (View v) {if (v. getId () = R. id. listener_imageView1) {// set the desktop background with a persistent click // 1. try {ListenerDemoActivity. this. clearWallpaper (); // ListenerDemoActivity. this. setWallpaper (getApplicationContext (). getResources (). openRawResource (R. drawable. pic1); textView2.setText ("the desktop background is set successfully! "); Bitmap bitmap = (BitmapDrawable) img. getDrawable ()). getBitmap (); ListenerDemoActivity. this. setWallpaper (bitmap);} catch (IOException e) {textView2.setText ("failed to set the mobile desktop background !! "); E. printStackTrace () ;}return false ;}}