当我在DDMS中使用AsyncTasks检查时,在onPostExecute()方法之后,该线程会作为等待线程继续停留在内存中,这是正常的吗?以下是一个简化的Activity,可以复现我的问题:
package com.example.async;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
public class ASyncTaskExampleActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new ExampleAsyncTask().execute();
}
private class ExampleAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
for (int i =0; i<50000;i++){
int j=i*2;
}
return null;
}
protected void onPostExecute(Void result) {
Log.d("Test","End onPostExecute");
}
}
}