I’m not able to see “MY DATA” in my AlertDialog as it gets overlapped by the EditText .
Context context = MyActivity.this;
AlertDialog.Builder alert = new AlertDialog.Builder(context);
alert.setTitle(" NEW TITLE");
alert.setMessage("MESSAGE 1");
final TextView tx = new TextView(this);
tx.setText("MY DATA");
alert.setView(tx);
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked OK so do some stuff */
}
});
alert.setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked Cancel so do some stuff */
}
});
alert.create();
alert.show();
Try this: