android - option item selection in Dialog menu -


I am currently running in a few difficulties and I think that needs your help :) I currently have a I'm trying to show a menu at the top of the dialogue, I know that it is so easy to start a new activity so far that I have to store / pass lots of data. I managed to show an option menu by typing a custom dialog and rewriting the oncreateOptionMenu method. My problem is that I can not get any listener in these buttons, I tried to re-write the method of opiantitime-selected but nothing happened. Ps: My dialogue is almost full screen, so I can not see the activity dialog (I did not find any top method)

I would be happy to provide any solutions that you can provide.

Thank you very much

Public Boolean On Krait Option Menu (menu menu) {super.onCreateOptionsMenu (menu); Menu.add (Menu.NONE, 0, Menu.NONE, c.getString (R.string.home)); Menu.add (Menu.NONE, 4, Menu.NONE, c.getString (R.string.report)); Back true; } Public Boolean On Option Item selected (menu item) {Super. Option System (items) selected; If (item.getItemId () == 0) {getOwnerActivity () StartActivity (New Intent (C, Home Class) .setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP)); } And if (L> 1) getOwnerActivity () StartActivity (new intent (c, report.class) .setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP)); And dismissed (); Back true; }

Maybe this little snippet from my app may help you: / P> Personal Static FINAL END REFRESH_ID = Menu.FIRST + 1; Public Boolean On Crate Option Menu (menu menu) {Boolean results = Super. Contempt option menu (menu); Menu.add (0, REFRESH_ID, 0, R.string.menu_refresh) .setIcon (R.drawable.and_refresh); Return result; } Maniteme selected on public boolean (int feature id, menu item) {switch (itat. ITMID)} {case REFRESH_ID: {// please whatever you want here! Back true; }} Come back super. Paramountime selected (feature ID, item); }

As you can see, I've got the constant for my menu item. Those items get menus Firstly for the number of each item as integer, I'll count it easy, then change it every time;) and selected in onMenuItem helps you hope that you can easily switch those constants!


Comments