2

I want to make a timer that changes a picture on the screen when the interval of the picture is over.

for(int x = 0; x < intervals.size(); x++)
            {
            t.schedule(new TimerTask(){

                @Override
                public void run() {      

                        runOnUiThread(new Runnable() {  
                            @Override
                            public void run() {
                                // TODO Auto-generated method stub

                                ImageView foto = (ImageView) findViewById(R.id.imageView1);

                                Bitmap bmp = sponsorlijst.get(index).getFoto();
                                foto.setImageBitmap(bmp);

                                if(index < sponsorlijst.size() -1)
                                {
                                    index ++;
                                }
                                else
                                {
                                    index = 0;
                                }

                            }
                            }

                        ); 
                };}, 0, intervals.get(x));

Intervals are a list with the different displaytime of the pictures and the pictures are in sponsorlijst.

Does anyone know how to change the interval of the timer while running? Thanks

Jolien
  • 43
  • 5

0 Answers0