public class M extends AsyncTask{
TextView t;
protected Context context;
public M(TextView t,Context context)
{
this.t=t;
this.context=context;
Toast.makeText(context, "进入构造方法", Toast.LENGTH_SHORT).show();
}
protected void onPreExecute()
{
}
protected Boolean doInBackground(Void...params)
{
new Thread(new Runnable()
{
public void run()
{
Toast.makeText(context, "开始睡眠", Toast.LENGTH_SHORT).show();
for(int i=0;i<60;i++)
{
try
{
Thread.sleep(1000);
}
catch(Exception e)
{}
publishProgress(i);
Toast.makeText(context, "i", Toast.LENGTH_SHORT).show();
}
}
});
return true;
}
protected void onprogressUpdate(Integer...values)
{
Toast.makeText(context, "执行UI设置", Toast.LENGTH_SHORT).show();
t.setText(values[0]);
}
protected void onpostExcute(Boolean result)
{
if(result)
{
Toast.makeText(context, "结束", Toast.LENGTH_SHORT).show();
//Toast.makeText(context, "即使一分钟完成", Toast.LENGTH_SHORT).show();
}
}
}
大神们帮我看看呗,现在学习进度实在是进行不下去了,一直卡在这个地方
一共五个方法,一个是构造方法,其他四个就是AsyncTask的四个重要方法
你好像没执行它的 execute()