我想在 AsyncTask 类中使用 findViewById() 方法...我尝试了 onPostExecute() 和 onPreExecute()。但它不起作用
class Proccess extends AsyncTask<String, Void, Void>{
@Override
protected Void doInBackground(String... arg0) {
TextView txt = (TextView) findViewById(R.id.tvResult); // cause error
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
TextView txt = (TextView) findViewById(R.id.tvResult); // cause error
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
TextView txt = (TextView) findViewById(R.id.tvResult); // cause error
}
}