popup message in android
i m developing an application..
i want to create a popup messa开发者_开发技巧ge that will be stable while we don't close...
I want some tutorial that help me to do a alertDialog boxes.
Thanks in advance.
I think you are searching for the "Dialog" box thereby you can show Alert message, confirmation message, etc. to the user.
For more info, refer this: http://developer.android.com/reference/android/app/Dialog.html ,
Here a good example on Alert Dialog box: http://www.androidpeople.com/android-alertdialog-example/ .
From your commented code:
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this).create();
alt_bld.setMessage("apprika target achieve...");
alt_bld.setCancelable(false);
alt_bld.setPositiveButton("yes", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } });
alt_bld.setNegativeButton("No", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.cancel(); } });
alt_bld.show();
And for showing up the Alert dialog box in the Click event, write the alert.show();
code inside the click listener.
AlertDialog.Builder(AlertDialogSamples.this)
.setIcon(R.drawable.alert_dialog_icon)
.setTitle(R.string.alert_dialog_two_buttons_title)
.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked OK so do some stuff */
}
})
.setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked Cancel so do some stuff */
}
})
.create();
you should look for a Dialog.
Tuturial1
Tutorial2
It will helps you.
精彩评论