Skip to content

Instantly share code, notes, and snippets.

@antew
Created February 10, 2013 06:20
Show Gist options
  • Save antew/4748610 to your computer and use it in GitHub Desktop.
Save antew/4748610 to your computer and use it in GitHub Desktop.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Get the username from the arguments, if one isn't passed
// we use a blank string so it still looks OK
String username = "";
if (getArguments().containsKey(USERNAME))
username = ", " + getArguments().getString(USERNAME);
// "Are you sure you want to log out, <username>?"
String message
= getString(R.string.are_you_sure_you_want_to_log_out) +
username +
"?";
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
b.setTitle(R.string.log_out);
b.setMessage(message) ;
b.setPositiveButton(R.string.yes, this);
b.setNegativeButton(R.string.no, this);
return b.create();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment