Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

popup message in android

Tags:

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 in advance.

like image 306
Siten Avatar asked Feb 13 '26 11:02

Siten


2 Answers

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.

like image 172
Paresh Mayani Avatar answered Feb 14 '26 23:02

Paresh Mayani


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();
like image 29
Pinki Avatar answered Feb 15 '26 00:02

Pinki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!