Android: Animating a popup menu automatically
How can we set the timer so that after completion of an Image-view animation, a pop up menu should come from bottom automatically with out the user intervention.
Help is always appreciated......!
here is the code
AnimationDrawable ekgframeAnimation4 =
(AnimationDrawable) ekgimgview4.getBackground();
if (ekgframeAnimation4.isRunning()) {
ekgimgview4.postDelayed(ekgframeAnimation4, 60000);
ekgframeAnimation4.stop();
findViewById(R.id.ekgimgview4).postDelayed(new Runnable()
{
public void run()
{
openOptionsMenu();
}
}, 60000);
}
else {
ekgframeAnimation4.stop();
ekgframeAnimation4.start();
ekgimgview4.postDelayed(ekgframeAnimation4, 60000);
findViewById(R.id开发者_运维知识库.ekgimgview4).postDelayed(new Runnable()
{
public void run()
{
openOptionsMenu();
}
}, 60000);
}
Do a View.postDelayed
call and in the Runnable call openOptionsMenu
.
EDIT: if your animation lasts 1000 milliseconds and there is a View with the id R.id.exampleview
, then something like this:
findViewById(R.id.exampleview).postDelayed(new Runnable()
{
public void run()
{
openOptionsMenu();
}
}, 1000);
should do it. Let me know if that works out for you.
精彩评论