Skip to content

Instantly share code, notes, and snippets.

@AfonsoFGarcia
Created November 27, 2014 12:28
Show Gist options
  • Save AfonsoFGarcia/e7cd7d33653058a98b50 to your computer and use it in GitHub Desktop.
Save AfonsoFGarcia/e7cd7d33653058a98b50 to your computer and use it in GitHub Desktop.
AlertDialog.Builder alert = new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT);
alert.setTitle(title);
alert.setCancelable(false);
AlertDialog dialog;
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//noinspection ConstantConditions
playerName = input.getText().toString();
if (playerName.equals("")) {
getName("Enter a valid name");
} else {
TextView player = (TextView) findViewById(R.id.playerName);
player.setText(playerName);
register(playerName);
while (me == null) {
}
setPoints(me.getScore().toString());
g.beginGame();
dialog.dismiss();
}
}
});
dialog = alert.create();
dialog.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment