Possible to move <menu <item android:onClick=method>> to different class? -


my main activity class contains oncreate(bundle), oncreateoptionsmenu(menu menu), onprepareoptionsmenu(menu menu) methods, , of android:onclick= methods (there many).

i reduce number of methods in main activity class, if possible. "is possible move onclick methods different class"?

thanks help.

you can create different class implements view.onclicklistener. in main activity code can use setonclicklistener on components want move click listener of , give class implements view.onclicklistener parameter.

edit: here link view.onclicklistener page on android developer website http://developer.android.com/reference/android/view/view.onclicklistener.html


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

php - Calling a template part from a post -

How to mention the localhost in android -