Hi,

I've got an application with one main activity, and I've got an error
dialog with a "ok" button on it, that when pressed calls "finish" on
the activity.  It seems to work fine when I test the app manually, but
when I run the "monkey" tool, it is somehow killing my dialog by
pressing 'Ok', but not finishing the app.

All my dialogs are managed by the activity, and here's my dialog
setup:

                case ERROR_DIALOG_ID:
                    Log.d("ErrorDialog", "Error Shown.");
                    errorDialogShown = true;
                        final Activity instance = this;
                        return new AlertDialog.Builder(this)
                                .setMessage(error)
                                .setCancelable(false)
                                .setPositiveButton(getText(R.string.ok), new
DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int id) {
                                    Log.d("ErrorDialog", "OK clicked.");
                                instance.finish();
                                    Log.d("ErrorDialog", "Finished.");
                           }
                                })
                                .create();

And here's my log output:

I/ActivityManager(  572): Starting activity: Intent
{ action=android.intent.action.MAIN categories=
{android.intent.category.LAUNCHER} flags=0x10000000 comp={XXX} }
D/onCreateDialog(  841): Showing progress dialog.
D/GpsLocationProvider(  572): setMinTime 0
W/KeyCharacterMap(  841): No keyboard for id 0
W/KeyCharacterMap(  841): Using default keymap: /system/usr/keychars/
qwerty.kcm.bin
D/progressDialog(  841): Try last loc clicked.
D/LocationManager(  841): removeUpdates: listener = x...@43753f58
D/ErrorDialog(  841): Error Shown.
I/ActivityManager(  572): Displayed activity XXX: 4993 ms
D/ErrorDialog(  841): OK clicked.
D/ErrorDialog(  841): Finished.
W/IInputConnectionWrapper(  678): showStatusIcon on inactive
InputConnection
I/AndroidRuntime(  876): AndroidRuntime onExit calling exit(0)
D/dalvikvm(  678): GC freed 1453 objects / 41216 bytes in 117ms

And the activity never dies--in other words, it's remaining visible to
the user.  It's like the dialog was dismissed, and that was it.  When
I hit the back button on the device, it'll destroy the instance.

Any ideas on what I'm doing wrong?

Thanks,
-Shemmy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to