我有一个正在运行的AsyncTask。我有一个TextView,我模仿Toast最初产生的消息。
我想在OnPostExecute成功后清除TextView,但它没有这样做。任务完成的Toast很好用。如何在OnPostExecute中将TextView设置为空白?用户仍然在显示TextView的屏幕上。
以下是错误条件的代码:
我想在OnPostExecute成功后清除TextView,但它没有这样做。任务完成的Toast很好用。如何在OnPostExecute中将TextView设置为空白?用户仍然在显示TextView的屏幕上。
以下是错误条件的代码:
@Override
protected void onPostExecute(Void result)
{ FetchingImage=0;
if(webLoadError>0)
{
TextView text = (TextView) findViewById(R.id.textView2);
String temp=" ";
text.setText(temp);
Toast.makeText(getApplicationContext(), "Image not available from the internet.\nDefault or last image loaded.\nTry again later.",Toast.LENGTH_LONG).show();
}
}
onPostExecute
内的text
,因为AsyncTask
是静态的。 - Marco Castanho