I want to refresh my tile after clicking on a Download all button. I m using GridAdapter to display a grids for multiple videos. So If i click on Download all Button tile grid should show a progress bar, But currently it is not showing without refreshing the entire page.

单击“全部下载”按钮后,我想刷新我的磁贴。我使用GridAdapter显示多个视频的网格。因此,如果我点击下载所有按钮磁贴网格应显示进度条,但目前它没有显示没有刷新整个页面。

We have tried below mentioned code on button click event but application getting crashed.....

我们在按钮点击事件上尝试了下面提到的代码但应用程序崩溃了.....

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);

2 个解决方案

#1


Your question is not very specific, but try the following two approaches:

您的问题不是很具体,但请尝试以下两种方法:

1) First and foremost, if you want to refresh a specific tile in your grid. Just call TileAdapter.notifyDataSetChanged();

1)首先,如果要刷新网格中的特定图块。只需调用TileAdapter.notifyDataSetChanged();

2) If you are trying to e.g. blur the entire Grid and show a loading bar on top of it. Find a reference to the View hosting the grid and call view.invalidate();

2)如果您正在尝试例如模糊整个网格并在其上显示加载栏。查找托管网格的View的引用并调用view.invalidate();

更多相关文章

  1. 按下子活动后退按钮后,Android主要活动的元素不响应
  2. JSP页面中有一个按钮 点击之后执行JAVA文件
  3. 不幸的是,在声明按钮时,模拟器中出现了错误
  4. 单击按钮后更改Frame的内容窗格
  5. 在Java中选择showMessageDialog框右上角的x按钮退出系统?

随机推荐

  1. Android——Tomcat版本更新下载+头像照片
  2. Android两种方式监听短信内容---Broadcas
  3. 如何通过MigLayout手动计算宽度
  4. Ubuntu 14.04搭建Android5.1开发环境和编
  5. 【android】在Eclipse中关联所引用的jar
  6. 如何从android的联系人姓名中获取联系人
  7. 求教:如何通过JNI调用手机自身摄像头录像
  8. android开发之流量监控
  9. 探秘腾讯Android手机游戏平台之不安装游
  10. android插件化-apkplug框架启动-02