I'm rewriting an existing app for Honeycomb and I've run into a problem. In the existing app, we create the an AlertDialog with default title and message values, then replace them later if needed. To replace them, we use setTitle() and setMessage():
AlertDialog dialog = getDialog();
if (some condition) {
dialog.setTitle(R.string.error1);
dialog.setMessage(getResources().getString(R.string.error1_msg));
}
else {
dialog.setTitle(R.string.error2);
dialog.setMessage(getResources().getString(R.string.error2_msg));
}
However, now that we are using DialogFragment, there is no method for setTitle() or setMessage(), so we can't change it after it has been created. Is there a workaround for this case, or are we out of luck?
You have to extend the DialogFragment to provide content. See the documentation for examples and other options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With