我正在使用一个朋友下载图片并设置在ImageView
;然而,我得到这个错误:设置imageView线程
Only the original thread that created a view hierarchy can touch its views.
这是我的代码。
ImageView profilePicture =....
Thread thread = new Thread() {
@Override
public void run() {
profilePic.setImageBitmap(image_profile);
}
};
thread.start();
的image_profile Bitmap
是一个有效的Bitmap
文件。 (我通过调试进行了检查。)
此线程运行在OnCreate
方法中。
+1解释运行其他任何方法比
doInBackground()
的ImageView
,而不是放弃代码 – Pragnani@Pragnani谢谢!这意味着你很多 – codeMagic