Reputation: 11227
Ist there a possibility to do something like that:
int selected_value = Dialog("This dialog show a combobox, i want to know which item is selected")
Or
String typed_chars = Dialog("This Dialog show a TextBox, i want to know the typed chars")
It is strongly recommended, that the code will stop while the dialog is shown and resume after dismissing the dialog, like the "showdialogforresult" method in c# or vb.net, I have to show lots of Dialogs and every dialog depends on former choices, I will become crazy if i have to code this with listener or callbacks...
Upvotes: 1
Views: 486
Reputation: 30954
While I don't think this is exactly possible like you do it, you do not need to code an anonymous class per Button callback.
Instead you can designate one class that implements DialogInterface.OnClickListener()
and which you specify for all of the buttons. Its onClick()
callback gets the information about which Dialog was invoked and which button was clicked. So you can operate within this onClick() method with some switch/case or if/else cascades.
Not perfect, but won't make you crazy :)
Upvotes: 2