Reputation: 6687
I want to display 5 images on a Map View as map overlay with an interval of 1 minute each. I use sleep to make a delay. But it is not working. After all delay, the images are displaying altogether. How to do this? Please help
Upvotes: 2
Views: 374
Reputation: 12905
Look at this link. I think, it is, what you need
http://developer.android.com/resources/articles/timed-ui-updates.html
UPD:
Define in your activity:
private Handler mHandler = new Handler();
private int cnt = 0;
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
if (cnt < 5)
{
// Display new Image
mHandler.postDelayed(mUpdateTimeTask, 60000);
cnt++;
}
else
{
mHandler.removeCallbacks(this);
}
}
};
and call then somwhere in onCreate or onResume
mHandler.postDelayed(mUpdateTimeTask, 60000);
Upvotes: 1