您好,登錄后才能下訂單哦!
package com.example.util; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnDismissListener; public class SelectSupplyDialog { public static boolean isShow = false; public static Builder builder; public static Dialog dialog; public SelectSupplyDialog(){ } // 彈窗結(jié)果回調(diào)函數(shù) public static abstract class ResultCallBack { public abstract void callback(int pos); } public static void showMyDialog(Context context, String title, String[] strArr, final ResultCallBack callback){ if(builder != null){ builder = null; } builder = new AlertDialog.Builder(context); builder.setIcon(android.R.drawable.ic_dialog_info); builder.setTitle(title); builder.setSingleChoiceItems(strArr, 0, new DialogInterface.OnClickListener() { public void onClick(DialogInterface builder, int which) { isShow = false; builder.dismiss(); callback.callback(which); } } ); dialog = builder.show(); isShow = true; builder.setCancelable(true); } public static void closeDialog(){ if(dialog != null && isShow == true){ dialog.dismiss(); } } } /** * 掃描人選擇 * @param v */ public void supply(View v){ SelectSupplyDialog.showMyDialog(mContext, "請選擇供應(yīng)商", strScanMan, new ResultCallBack() { @Override public void callback(int pos) { } }); } private String[] strScanMan = {"張飛","劉備","關(guān)羽"};
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。