showListDialog: 选取时区,然后设置
DialogUtil.showListDialog( mContext, TIMEZONE, "选择时区", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //自定义逻辑处理 /** SettingSpData.setTimezone(mContext,which); DateUtil.setTimeZone(mContext, TIMEZONE[which]); mHandler.postDelayed(new Runnable() { @Override public void run() { initTextView(); } },200); */ } } ); public final String[] TIMEZONE = { "GMT-11:00", "GMT-10:00", "GMT-08:00", "GMT-07:00", "GMT-06:00", "GMT-05:00", "GMT-04:30", "GMT-04:00", "GMT-03:00", "GMT-02:00", "GMT-01:00", "GMT+00:00", "GMT+01:00", "GMT+02:00", "GMT+03:00", "GMT+04:00", "GMT+04:30", "GMT+05:00", "GMT+05:30", "GMT+05:45", "GMT+06:00", "GMT+06:30", "GMT+07:00", "GMT+08:00", "GMT+09:00", "GMT+09:30", "GMT+10:00", "GMT+11:00", "GMT+12:00" };showViewDialog: 自定义密码输入对话框
private EditText etPassword; private int times = 3; private void showPasswordDialog(final String path){ etPassword = new EditText(this); //设置仅数值输入 etPassword.setInputType(InputType.TYPE_CLASS_NUMBER); //隐藏密码(".") etPassword.setTransformationMethod(PasswordTransformationMethod.getInstance()); DialogUtil.showViewDialog(this, "输入密码" + "(" + times-- + ")", etPassword, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch(which){ case DialogInterface.BUTTON_NEGATIVE: //也可以直接关闭 dialog.dismiss(); invalidPassword(); break; case DialogInterface.BUTTON_POSITIVE: //内置存储密码 String pass = SharePreDao.getUsbPassword(getApplicationContext()); if(etPassword.getText().toString().equals(pass)){ //密码正确 //to do }else{ dialog.dismiss(); invalidPassword(); } break; } } }); } private void invalidPassword(){ if(times>0){ //重新输入 showPasswordDialog(); }else{ //提示 showToast("连续三次错误!"); //to do } }