我正在一个android项目>>>> 当我尝试在android的doInBackground()方法中做任何代码...它不会给出错误,但不会运行正确.... 这是我的代码...我们可以把我们的编程doInBackground()在android
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap>
{
protected Bitmap doInBackground(String... urls)
{
button.setVisibility(View.VISIBLE);
return DownloadImage(urls[0]);
}
protected void onPostExecute(Bitmap result)
{
ImageView img = (ImageView) findViewById(R.id.img);
img.setImageBitmap(result);
}
}
此代码正常工作,当我删除button.setVisibility(View.VISIBLE);
我的查询,我们可以做这样可见性关闭或节目的类型doInBackground()方法....
你不能更新'UI'在'doInBackground' –
此线button.setVisibility(View.VISIBLE);在onPostExecute(位图结果)它可能会帮助你 – mayuri
@Shayanpourvatan如果我们可以更新,而不是为什么它不运行... PLZ看到我的完整代码http://pastie.org/8567194 –