Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Screenshot API with dialogs and toasts, who is their parent?

Tags:

android

(This question extends beyond Get root view from current activity)

Using getWindow().getDecorView(), I was able to get the drawing cache of the root view, however, if I incur any dialogs or toast, they are not presented in the root view.

How is Toast presented as a view? Where does it attach to? And is it possible to get the parent view's drawing cache as well?

Thanks

like image 787
Edison Avatar asked Nov 13 '22 08:11

Edison


1 Answers

Toasts belongs to the operating system.(You may be passing your application's/activities context, but it's not actually bound to your activity once it is called) Hence they are not part of your activity and therefore can not be seen in the root view. A toast is shown even if your Activity is stopped or moved to background immediately after calling ToastObject.show();

like image 183
Vishnuprasad R Avatar answered Nov 16 '22 02:11

Vishnuprasad R