Issue
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
Solution
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);
Answered By - Tima
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.