阅读更多

这时我封装的一个对话框工具类

package com.icare.midea.dialog;import com.icare.midea.R;import com.icare.midea.app.AppSession;import com.icare.midea.bll.UserBll;import com.icare.midea.util.Encryption;import android.app.Dialog;import android.app.ProgressDialog;import android.content.Context;import android.os.Handler;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.Toast;public class LoginDialog {private static Toast myToast;public static Dialog getDialog(final Context context,final Handler myHandler,final ProgressDialog progressDialog) {myToast = Toast.makeText(context, "",Toast.LENGTH_SHORT);// 弹出云服务输入窗口Dialog dialog = new Dialog(context, R.style.dialog);dialog.setContentView(R.layout.setcloudpasword);Button btLogin = (Button) dialog.findViewById(R.id.bt_OK);final EditText et_cloudPass = (EditText) dialog.findViewById(R.id.et_cloudpasswd);btLogin.setOnClickListener(new Button.OnClickListener() {public void onClick(View v) {if (et_cloudPass.getText().toString().trim().length() == 0) {myToast.cancel();myToast.setText("云服务密码不能为空!");myToast.show();return;} else {progressDialog.show();Encryption encryption = new Encryption();// 创建加密工具类,对象AppSession.cloudpassword = encryption.getDoubleMd5(et_cloudPass.getText().toString().trim(), "midea");// 对密码进行md5加密//UserBll.Blind(myHandler);// 进行,新用户绑定UserBll.Login(myHandler);// 进行,新用户绑定}}});return dialog;}}

 只要看主要的几行代码就ok了,其他的可以忽略不计,当然我的对话框识没有标题的,所以需要自定义一个风格

<?xml version="1.0" encoding="utf-8"?>    

更多相关文章

  1. Android(安卓)ExpandableListActivity 学习笔记
  2. Android(安卓)ExpandableListActivity 学习笔记
  3. Android自定义对话框
  4. Android(安卓)AsyncTask原理分析
  5. android远程绑定与本地绑定区别
  6. Android开机速度 ------之ART预优化dex2oat
  7. Android在网络中与JavaWeb的项目进行交互的方法
  8. android工程gen目录无法生成的解决办法汇总
  9. android之webview无网络情况下简单处理

随机推荐

  1. Android修改默认控件焦点不highlight
  2. 安装Android(安卓)Studio——Installing
  3. android图片切换ImageSwichter的动画切换
  4. Android(安卓)SDK下载
  5. Android相对布局
  6. android http 请求方式
  7. Android(安卓)之 WebView
  8. android:layout_height="match_parent"和
  9. Android(安卓)的运行机制
  10. Android(安卓)SDK相关问题