tags:

views:

54

answers:

2

Hi ,

I'd like to know how to generate a fake press button event . The button in cause is a options menu button. Please tell me if this is possible, or sugest other references !

Thanks !

+1  A: 

If it is your own code, frequently it will be simpler to use other techniques. For example, to open the options menu, call openOptionsMenu() on your Activity.

If it is for some other application's code, you cannot "generate a fake press button event".

CommonsWare
A: 

you try using

mBtn.performClick()();

it calls onClickListner of that button, if it is set by you. And If you want it be fake click do nothing in the body of onClickListner()

Kantesh