I have a class that extends GLSurfaceView and implements Renderer in my Android application that takes care of opengl rendering. When I try to execute asynctask from the onSurfaceCreated event, the application crashes (no exceptions are thrown). If you run the same async task from the main action, everything will be fine. The asynctask implementation is currently just the owner of the place:
public class DownloadImageTask extends AsyncTask<String, Void, Integer>
{
@Override
protected Integer doInBackground(String... myParams) {
return 1;
}
@Override
protected void onPostExecute(Integer result)
{
}
}
called from onSurfaceCreated ()
new DownloadImageTask().execute("myParam");
Why can't I launch AsyncTask from the onSurfaceCreated event?
source
share