I m storing image
from server in an Bitmap arrayList
, then using a thread
which waits 3 second, switching the image.Suppose the size of arraylist
is 3.then after switching 3 image one after another, its waiting another 3sec but now there is no image. and again its circulating from 0.
I m not getting why this extra 3sec its waiting.
Code for the tread is..
ImageSwitcher dailywear;
ArrayList<Bitmap> bitmapDailywear = new ArrayList<Bitmap>();
dailyWear.setImageDrawable(new BitmapDrawable(bitmapDailyWear.get(0)));
final Handler handler = new Handler();
final Runnable r = new Runnable() {
int i = 1;
public void run() {
dailyWear.setImageDrawable(new BitmapDrawable(bitmapDailyWear.get(i)));
i++;
if (i == bitmapDailyWear.size())
i = 0;
handler.postDelayed(this, 3000);
}
};
handler.postDelayed(r, 3000);