Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.AlertDialog;

import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class Main {

    public static void displayAlert4SingleChoice(Context context, String title, boolean cancelable,
            String[] selectNames, final DialogInterface.OnClickListener onClickListener) {
        AlertDialog accountDlg = new AlertDialog.Builder(context).setTitle(title).setCancelable(cancelable)
                .setSingleChoiceItems(selectNames, -1, new OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (null != onClickListener) {
                            onClickListener.onClick(dialog, which);
                        }

                        dialog.dismiss();
                    }
                }).create();
        accountDlg.show();
    }
}