org.androidannotations.annotations
Annotation Type OptionsItem


@Retention(value=CLASS)
@Target(value=METHOD)
public @interface OptionsItem

This annotation is intended to be used on methods to receive click on menu items.

The annotation value should be one or several of R.id.* fields. If not set, the method name will be used as the R.id.* field name.

The method may return a boolean, void, or a Boolean. If returning void, it will be considered as returning true (ie: the method has handled the event).

The method MAY have one parameter:

Example :
 @EActivity(R.layout.main)
 @OptionsMenu({ R.menu.my_menu1, R.menu.my_menu2 })
 public class MyActivity extends Activity {
 
        @OptionsItem
        void menuRefreshSelected() {
                // ...
        }
 
        @OptionsItem({ R.id.menu_search, R.id.menu_share })
        boolean multipleMenuItems() {
                return false;
        }
 
        @OptionsItem
        void menu_add(MenuItem item) {
                // ...
        }
 }
 

See Also:
OptionsMenu, OptionsMenuItem

Optional Element Summary
 String[] resName
           
 int[] value
           
 

value

public abstract int[] value
Default:
-1

resName

public abstract String[] resName
Default:
""


Copyright © 2010-2014. All Rights Reserved.