show Dialog - Android android.content

Android examples for android.content:DialogInterface

Description

show Dialog

Demo Code

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

public class Main{

    public static void showDialog(Context context, String title,
            String content, String positiveBt,
            DialogInterface.OnClickListener positiveLisenter,
            String negativeBt,/*from w ww . ja  va 2s .  co  m*/
            DialogInterface.OnClickListener negativeLisenter) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context)
                .setTitle(title).setMessage(content)
                .setPositiveButton(positiveBt, positiveLisenter)
                .setNegativeButton(negativeBt, negativeLisenter);

        AlertDialog dialog = builder.create();
        dialog.show();
    }

}

Related Tutorials