Java – how to callback after the view is fully rendered?
•
Java
How to callback after the view is fully rendered?
I tried to call a method to take a screenshot of the parent view If I write this code in the oncreate () method, the application crashes due to null pointers (because there is no rendered view) The temporary solution I've implemented now is to delay by 1 second before calling the method However, I am looking for a more powerful solution to this problem
Any suggestions and help are appreciated Thank you:)
Solution
Try this logic... Always call the view that has been focused or rendered or lost focus
@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); doWhateverAfterScreenViewIsRendered(); }
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
二维码