show Info Dialog - Android android.app

Android examples for android.app:AlertDialog

Description

show Info Dialog

Demo Code

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

public class Main {

  public static void showInfoDialog(Context context, int titleID, int messageID, int okID) {
    String title = context.getResources().getString(titleID);
    String message = context.getResources().getString(messageID);
    new AlertDialog.Builder(context).setIcon(android.R.drawable.ic_dialog_info).setTitle(title).setMessage(message)
        .setPositiveButton(okID, new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();/*from  w w  w .ja v  a  2 s  . c  o m*/
          }
        }).show();

  }

}

Related Tutorials