android小实例

android小实例

ID:38097551

大小:39.39 KB

页数:25页

时间:2019-06-06

android小实例_第1页
android小实例_第2页
android小实例_第3页
android小实例_第4页
android小实例_第5页
资源描述:

《android小实例》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、android小实例LoginActivity.java类:packagecom.example.empandroid;importandroid.app.Activity;importandroid.app.ProgressDialog;importandroid.content.Intent;importandroid.database.Cursor;importandroid.os.Bundle;importandroid.text.Editable;importandroid.text.TextWatcher;importandr

2、oid.view.View;importandroid.view.View.OnClickListener;importandroid.widget.Button;importandroid.widget.EditText;importandroid.widget.Toast;publicclassLoginActivityextendsActivityimplementsOnClickListener{EditTextusername,password;Buttonlogin,register,bt_username_clear,bt_

3、pwd_clear;DBHelperhelper=newDBHelper(this);ProgressDialogm_dlog;privateTextWatcheruname_watcher;privateTextWatcherpwd_watcher;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.login_main);username=(EditText

4、)findViewById(R.id.username);password=(EditText)findViewById(R.id.password);login=(Button)findViewById(R.id.login);register=(Button)findViewById(R.id.register);bt_username_clear=(Button)findViewById(R.id.bt_username_clear);bt_pwd_clear=(Button)findViewById(R.id.bt_pwd_cle

5、ar);login.setOnClickListener(this);register.setOnClickListener(this);bt_username_clear.setOnClickListener(this);bt_pwd_clear.setOnClickListener(this);initWatcher();username.addTextChangedListener(uname_watcher);password.addTextChangedListener(pwd_watcher);}publicvoidinitW

6、atcher(){uname_watcher=newTextWatcher(){@OverridepublicvoidonTextChanged(CharSequencearg0,intarg1,intarg2,intarg3){}@OverridepublicvoidbeforeTextChanged(CharSequencearg0,intarg1,intarg2,intarg3){}@OverridepublicvoidafterTextChanged(Editables){if(s.toString().length()>0){b

7、t_username_clear.setVisibility(View.VISIBLE);}else{bt_username_clear.setVisibility(View.INVISIBLE);}}};pwd_watcher=newTextWatcher(){@OverridepublicvoidonTextChanged(CharSequencearg0,intarg1,intarg2,intarg3){}@OverridepublicvoidbeforeTextChanged(CharSequencearg0,intarg1,in

8、targ2,intarg3){}@OverridepublicvoidafterTextChanged(Editables){if(s.toString().length()>0){bt_pw

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。