I've done some search in the internet. Some suggests use of PixelCopy API or Canvas. However, either way is limited to get the bitmap of the decor view. If there is a toast or AlertDialog on top of current activity, their images would not appear in the final bitmap.
So my question is, can I get bitmap of the whole activity, not only view, so the bitmap contains any Dialog or Toast on top of the activity?
So my question is, can I get bitmap of the whole activity, not only view, so the bitmap contains any Dialog or Toast on top of the activity?
Yes, we can use the window manager to get access to all the views in the hierarchy.
How to achieve this:
Object
holding the view hierarchy you needed.mGlobal
, mRoots
, and mParams
.A thoughtful implementation of this is done here Falcon .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.