我需要能够从AsyncTask访问我的listview的simpleadapter,所以我被告知我应该将arrayAdapter声明为GLOBAL。我怎么能这样做?
请用代码举例说明(这是我最了解的)
谢谢
答案 0 :(得分:0)
其他任何变量......
class MyActivity extends Activity {
private ArrayAdapter arrayAdapter;
protected void onCreate(Bundle save) {
super.onCreate(save);
....
arrayAdapter = new...
}
class myAsyncTask extends AsyncTask<Void, Void, Void> {
protected Void doInBackground(Void... params) {
arrayAdapter...
}
}
}