ActionBarSherlockIntegration - PerfectCarl/androidannotations GitHub Wiki

Since AndroidAnnotations 2.6

AndroidAnnotations integrates smoothly with ActionBarSherlock.

You just need to use the ActionBarSherlock library in a standard way, and then annotate your activities with AndroidAnnotations.

@EActivity(R.layout.my_layout)
public class MyActivity extends SherlockActivity {
}

Options Menu

ActionBarSherlock overrides the Options menu mechanism, and provides its own alternate implementation. When using annotations dedicated to Options Menu, AndroidAnnotations detects ActionBarSherlock and uses the alternate implementation.

@EActivity(R.layout.my_layout)
@OptionsMenu(R.menu.my_menu)
public class MyActivity extends SherlockActivity {

    @OptionsItem
    void menuRefreshSelected() {
    }

    @OptionsItem({ R.id.menu_search, R.id.menu_share })
    void multipleMenuItems() {
    }

    @OptionsItem
    boolean menuAdd(MenuItem item) {
        return true;
    }
}