Back to project page CommonLibs.
The source code is released under:
Apache License
If you think the Android project CommonLibs listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.alex.common.utils; // w ww.ja v a2 s .co m import com.alex.common.R; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; /** * ?????Dialog????? * @author caisenchuan */ public class DialogUtils { /*-------------------------- * ??? *-------------------------*/ /*-------------------------- * ????? *-------------------------*/ /*-------------------------- * ???????? *-------------------------*/ /*-------------------------- * public?? *-------------------------*/ /** * ??????????????? * @param context ??? * @param title ?????? */ public static void showOKButtonDialog(Context context, String title) { showOKButtonDialog(context, title, null); } /** * ??????????????? * @param context ??? * @param title ?????? * @param ok_listener ???????????? * @author lenovo */ public static void showOKButtonDialog(Context context, String title, AlertDialog.OnClickListener ok_listener) { AlertDialog dlg = new AlertDialog.Builder(context).create(); dlg.setTitle(title); dlg.setButton(Dialog.BUTTON_NEGATIVE, context.getString(R.string.ok), ok_listener); dlg.show(); } /** * ???????????????????? * @param context ??? * @param title ?????? * @param ok_listener ???????????? * @author lenovo */ public static void showOKCancelButtonDialog(Context context, String title, AlertDialog.OnClickListener ok_listener) { AlertDialog dlg = new AlertDialog.Builder(context).create(); dlg.setTitle(title); dlg.setButton(Dialog.BUTTON_NEGATIVE, context.getString(R.string.ok), ok_listener); dlg.setButton(Dialog.BUTTON_POSITIVE, context.getString(R.string.cancel), new AlertDialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //... } }); dlg.show(); } /** * ??????????????????? * @param context * @param title * @return */ public static Dialog buildSpinnerProgressDialog(Context context, String title) { ProgressDialog dialog = new ProgressDialog(context); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setMessage(title); dialog.setIndeterminate(false); dialog.setCancelable(false); return dialog; } /*-------------------------- * protected??packet?? *-------------------------*/ /*-------------------------- * private?? *-------------------------*/ }