I think I understand the issue, but I'm puzzled why you can't simply
refactor your code to the Android API. Here's an example.
Activity.myMethod() {
{ block A }
ret = showModalDialog(); // they way you expect it to work
if (ret == 1) {
{ block B }
}
This can be refactored to:
Activity.onCreateDialog() {...
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(Do you want to continue?)
.setCancelable(false)
.setPositiveButton(Yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
* { block B }*
MyActivity.this.finish();
}
})
.setNegativeButton(No, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
...}
Activity.myMethod() {
{ block A }
showDialog(CONTINUE_WITH_B_DIALOG);
}
If this code is correct, doesn't it accomplish the same behavior from the
user's point of view?
On Mon, Jan 18, 2010 at 8:34 AM, swapnil kamble swap.kam...@gmail.comwrote:
I have solved this problem by a synch point between two thread i.e. using
CountDownLatch
On Mon, Jan 18, 2010 at 6:32 PM, skink psk...@gmail.com wrote:
On Jan 18, 1:52 pm, ls02 agal...@audible.com wrote:
Yes, I read Android docs about dialogs. However, this still does not
answer my trivial questions. I also do not want to block UI thread.
Blocking UI thread means you block message pump and UI becomes
unresponsive. What I want is to call the function from UI thread that
would popup the dialog and this function will not return until the
dialog is closed. It is obvious that this modal dialog internally must
implement message pump and break this message loop when user closes
the dialog. Something similar to DialogBox or MessageBox Windows APIs.
I understand that I can implement OnClickListener, but this will
effectively call another function in the activity class that pops up
this dialog. I cannot this way to return to the same execution point
in the function that popped up the dialog.
If Android does not have truly modal dialog I wonder what the
suggested approach to the following standard situation. Say you have
function that at certain point needs to prompt user for some input via
a modal dialog and then must use the input from the dialog to continue
its execution.
see:
http://groups.google.com/group/android-developers/browse_thread/thread/f8f1ac25831adcf5/c651bb429b694bba?lnk=gstq=modal+dialog#c651bb429b694bba
pskink
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
...Swapnil
|| Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
|| Hare RamaHare Rama Rama RamaHare Hare ||
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en