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

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -