Code example for ListFragment

Methods: onCreate, setHasOptionsMenu

0
 
        private boolean ascSort = true;
 
        @Override 
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
 
            setHasOptionsMenu(true);
        } 
 
        @Override 
        public void onViewCreated(View view, Bundle savedInstanceState) {
            super.onViewCreated(view, savedInstanceState);
 
            final List<MenuListItem> listItems = new ArrayList<MenuListItem>();
            listItems.add(new MenuListItem(R.string.menu_01, 1));
            listItems.add(new MenuListItem(R.string.menu_02, 2));
            listItems.add(new MenuListItem(R.string.menu_03, 3));
            ListItemArrayAdapter.createAndAttach(this, listItems);
        }