doInBackground() works fine.. code after Looper.loop() will not work. Log not printing after Looper.Loop() and not executing onPostExceute(). I need to wait until method 1,2,3 execute. Exception will occure in method1 if Looper.prepare() not used.
@Override
protected Void doInBackground(Void... params) {
try {
if (Looper.myLooper() == null)
Looper.prepare();
method1();
method2();
method3();
Looper.loop();
Log.d(TAG,"after loop()");
} else {
method4(); //inside asyn task
}
Log.d(TAG,"doInBackground end");
}catch (Exception e) {
Log.d(TAG,"doInBackground exception "+e);
}
return null;
}
@Override
protected void onPostExecute(Void result) {
try {
Log.d(TAG, "onPostExecute");
//............
}catch (Exception e){
Log.d(TAG,"onPostExecute end");
}
}
@Override
protected void onPreExecute() {
//.....
}