点击“全部下载”按钮后,我想刷新我的图块。我使用GridAdapter显示多个视频的网格。所以,如果我点击下载所有按钮平铺网格应该显示一个进度条,但目前它没有显示没有刷新整个页面。
我们在按钮点击事件上尝试了下面提到的代码但应用程序崩溃了.....
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Do something after 100ms
File tempfile = new File(mContext.getExternalFilesDir(course_name),productCode);
if(tempfile.exists()){
viewHolder.mProgressBar.setVisibility(View.VISIBLE);
iewHolder.mImageView.setVisibility(View.INVISIBLE);
}else{
File tempthumbfile = new File(mContext.getExternalFilesDir(course_name),fname);
Log.d("tempthumbfile-->",""+tempthumbfile);
if(tempthumbfile.exists()){
viewHolder.mImageView.setBackgroundDrawable(Drawable.createFromPath(new File(mContext.getExternalFilesDir(course_name),fname).getAbsolutePath()));
}
viewHolder.mProgressBar.setVisibility(View.INVISIBLE);
viewHolder.mImageView.setVisibility(View.VISIBLE);
}
handler.postDelayed(this, 2000);
}
}, 1500);
答案 0 :(得分:0)
试试这个:
Runnable task = new Runnable() {
public void run() {
this.runOnUIThread(new Runnable() {
public void run() {
// TODO: add your job/functionality here
}
});
}
}