主题代码是:
public class AsyncTask1 extends AsyncTask <Void, Void, Boolean>{
@Override
protected Boolean doInBackground(Void... params){
//...
asyncTask2 = new AsyncTask2();
//...
Log.i("AsyncTask1","Launch asyncTask2");
String taskResult = tasyncTask2.execute().get().toString();
//...
}
//...
}
public class AsyncTask2 extends AsyncTask <Void, Void, String>{
//...
@Override
protected String doInBackground(Void... params){
Log.i("AsyncTask2", "I have started");
//...
}
//...
}
此代码模板适用于 2.3.5 和 4.2,但在 Jelly Bean 更新后无法正常工作。为什么?
2.3.5
AsyncTask1 通知 +
AsyncTask2 通知 +
4.2(更新后):
AsyncTask1 通知 +
AsyncTask2 通知 -