Hello all, I'm looking for a little more information about dialogs managed by activities than is provided here:
http://developer.android.com/guide/topics/ui/dialogs.html and havn't found any good web resources. In particular, I'm having a problem where a dialog must be updated in onPrepareDialog() with Activity member variables that change after onCreateDialog() is initially called. During an orientation change, version 1.5 will only call onCreateDialog() and not onPrepareDialog() for dialogs previously used (and not dismissed). An example problem scenario's onPrepareDialog() steps are listed here: final Spinner spinner2 = (Spinner) ((AlertDialog) dialog).findViewById(R.id.spinner2); ArrayAdapter<myItem> spinnerAdapter = new ArrayAdapter<myItem>( context, android.R.layout.simple_spinner_item, myList); spinnerAdapter.setDropDownViewResource (android.R.layout.simple_spinner_dropdown_item); spinner2.setAdapter(spinnerAdapter); // setting button here, as it needs update for every spinner update ((AlertDialog) dialog).setButton(AlertDialog.BUTTON_POSITIVE, "Add", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int i1) { int id = ((myItem spinner2.getSelectedItem()).id; doSomething(); } }); The result of not calling onPrepareDialog() during orientation change, if the dialog is currently being displayed, is an empty spinner. In 1.6, onPrepareDialog() is also called and so this problem is not seen. As a workaround for 1.5 I simply remove the dialog in onResume(), but obviously if the dialog is showing on orientation change the user experience is not ideal. I don't expect this is a 1.5 bug so much as a lack of my understanding regarding what the "right thing to do" is in such a situation, where information is not known at dialog creation time. Thank you, Steve Abrams -- 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

