Suggested Pages

Tuesday, January 17, 2017

Dialog Android

Dialog Example

...

import android.app.AlertDialog;
import android.content.DialogInterface;

import com.example.myapp.R;

public class NotificationDialog {

 public static void dialog(android.content.Context activity, int title, int message) {
 
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);

    builder = builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
       
                public void onClick(DialogInterface dialog, int id) {
                       dialog.cancel();
                  }
            });
 
    builder = builder.setTitle(title).setMessage(message).setIcon(R.drawable.dialogo_alert);

    builder.create().show();
 }

}

No comments :

Post a Comment

Suggested Pages