Issue
In my activity i throw a new one with this code:
intent = new Intent(this, NewActivity.class);
startActivity(intent);
How to show a message before launching new activity? I would like to show a warning to users before going to new activity, in which just press OK button to go on...
Solution
Simply create a dialog.
Dialog dialog = new AlertDialog.Builder(getActivity())
.setMessage(R.string.dialog_fire_missiles)
.setPositiveButton(R.string.fire, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(MainActivity.this, NewActivity.class);
startActivity(intent);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
}).create();
dialog.show();
Answered By - Misagh Emamverdi Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.