edi233
edi233

Reputation: 3031

Animation and active button

This is my situation. I have two activities: ONE and TWO. In TWO activity is button and picture. This picture is animated. Animation is during 5 seconds. When I start activity TWO from Activity ONE animation is started and after 5 seconds is stopped. I want that this button on activity TWO is disabled until animation ends. When animation ends then button get enabled and I can click on it. How I can do this?

Edit1: Can I check if my animation is over?

Upvotes: 0

Views: 836

Answers (2)

5hssba
5hssba

Reputation: 8079

Try like this..put this in oncreate

button.setEnabled(False);
imageview.postDelayed(new Runnable() {<--imageview is your image
@Override
public void run() {
    button.setEnabled(True);
}
}, 5000);

Upvotes: 2

himanshu
himanshu

Reputation: 1980

you can make your button disable for 5 second by btn.setEnabled(false) and make btn.setEnabled(true) after 5 seconds.

Upvotes: 1

Related Questions