GridView中使用countdowntimer导致getView重复调用?

星空kentlee 2016-10-28 12:52:25
请问这是什么原因呢?
这是adapter中的getview()方法
@Override
public View getView(int position, View convertView, ViewGroup parent) {
holder = new NewHolder();
if(convertView==null){
convertView = inflate.inflate(R.layout.item_grid,null);
holder.iv_pic = (ImageView)convertView.findViewById(R.id.iv_goods_img);
holder.tv_goods_name = (TextView)convertView.findViewById(R.id.tv_goods_name);
holder.tv_time = (TextView)convertView.findViewById(R.id.tv_time);
convertView.setTag(holder);
}else{
holder = (NewHolder)convertView.getTag();
}
VolleyLog.e("getView"+" position="+position);
Map map = (Map) getItem(position);
String time = map.get("time").toString();
holder.tv_goods_name.setText(map.get("name").toString());
holder.tv_time.setText(time);
imageLoader.displayImage(map.get("img").toString(),holder.iv_pic);
MyCountDownTimer timer = new MyCountDownTimer(comparedata(time),70,holder.tv_time);
timer.start();
return convertView;
}
当countDownTime开始后,一直会重复调用getview ,也会多次执行其中的方法,请问大家有什么解决方案呢?
...全文
216 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
星空kentlee 2016-11-18
  • 打赏
  • 举报
回复
星空kentlee 2016-10-28
  • 打赏
  • 举报
回复

可以看出getview一直在不断执行

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧