Skip to content Skip to sidebar Skip to footer

Popup Message In Android

i m developing an application.. i want to create a popup message that will be stable while we don't close... I want some tutorial that help me to do a alertDialog boxes. Thanks i

Solution 1:

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.Builderalt_bld=newAlertDialog.Builder(this).create();     
alt_bld.setMessage("apprika target achieve...");
alt_bld.setCancelable(false);
alt_bld.setPositiveButton("yes", newOnClickListener() { publicvoidonClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } });
alt_bld.setNegativeButton("No", newOnClickListener() { publicvoidonClick(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.

Solution 2:

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() {
                    publicvoidonClick(DialogInterface dialog, int whichButton) {

                        /* User clicked OK so do some stuff */
                    }
                })
                .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                    publicvoidonClick(DialogInterface dialog, int whichButton) {

                        /* User clicked Cancel so do some stuff */
                    }
                })
                .create();

Solution 3:

you should look for a Dialog.

Tuturial1

Tutorial2

It will helps you.

Post a Comment for "Popup Message In Android"