I'd like to take a screenshot as soon as the activity finishes drawing its layout. To take the screenshot I am using the rootView.setDrawingCacheEnabled(true); and getDrawingCache. My problem is that if the activity hasn't finished loading, that doesn't work.
I tried creating a thread that waits until getDrawingCache isn't null. But that's just aweful code, and crashes pretty often. Is there anyway to know when did an activity finish drawing its layout?
Thank you.
Try overriding Activity's method :
public void onWindowFocusChanged(boolean hasFocus)
The activity should be finished drawing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With