How to make a callback after the view is completely rendered?
android, callback, java, view
Solution
I have got a better option now :) this really gives a call-back after the layout is rendered
private class LoadActivity extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
mainMethod();
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
takeScreenShot(1);
}
@Override
protected String doInBackground(String... params) {
return null;
};
}
I created the above class and then called this method for execution in onCreate()
LoadActivity loadactivity= new LoadActivity();
loadactivity.execute();
Problem
How to make a callback after the view is completely rendered ? I am trying to call a method which takes a screen-shot of parent view. If I write that code in `onCreate()` method, the app crashes due to null pointer (as no view is rendered). for now the temporary solution I have implemented is to make a delay of 1 second before calling that method. But, I am looking for a much more robust solution to this problem. any suggestions and help appreciated. thanks :)