Talking about Android getting pictures on ImageView and a possible problem

1. Call setdrawingcacheenabled (true) before obtaining the picture:

Example: mimageview.setdrawingcacheenabled (true);

2. After that, you can get the picture through getdrawingcache()

Example: bitmap obmp = bitmap. Createbitmap (mimageview. Getdrawingcache())// Get the image of bitmap

3. Remember to call setdrawingcacheenabled (false) after getting the picture

Example: mimageview.setdrawingcacheenabled (false);

That's it.

Add: if you encounter this line of code, bitmap obmp = bitmap. Createbitmap (mimageview. Getdrawingcache()); Null pointer error!!!!!!

terms of settlement:

Before that, add the following code

The above article discusses how Android obtains the pictures on ImageView, and a possible problem is that Xiaobian has shared all the contents with you. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>