Reputation: 670
I need to have a button automatically click. Either on the creation of the activity, or on a timer that I will set to a very short time. Can anyone help me out with this. How do I call for the button to be clicked?
Upvotes: 2
Views: 12085
Reputation: 9897
yourbutton.post(new Runnable(){
@Override
public void run() {
mybutton.performClick();
}
});
Upvotes: -1
Reputation: 2145
Put all the code of your button in OnCreate()
and change the button background so it looks like clickable
when your activity start..
Upvotes: 0
Reputation: 69
if you want to on Click automatic . Please call ButtonName.performClick(); NOTE : you must Setonclick for that Button
Upvotes: 1
Reputation: 37516
You can call the OnClickListener
(if any) using performClick().
Upvotes: 9