处理程序定期延迟Android

时间:2018-12-20 10:13:34

标签: java android mobile-application

我想在listview中循环运行图像。我尝试使用处理程序,但  它不像我想要的那样工作。

 final Handler handler = new Handler();
    handler.postDelayed(new Runnable(){
        public void run(){
     Glide.with(context).load(images[position]).into(viewHolder.imageView);
            handler.postDelayed(this, 1000);
        }

    }, 500);


    final Handler handler2 = new Handler();
    handler2.postDelayed(new Runnable(){
        public void run(){           

Glide.with(context).load(secondimages[position]).into(viewHolder.imageView);
            handler2.postDelayed(this, 2000);
        }

    }, 1000);

0 个答案:

没有答案