How can I emulate clicking a button in my application test. I tried to set focus on the button and send the keypress “Enter” but no cigar.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just call the
performClick()method. See the View docs for reference.Or, if developing for Ice Cream Sandwich (API Level 15), the
callOnClick()method was added.performClick()is more than suitable for your needs, though.