2019独角兽企业重金招聘Python工程师标准>>>
代码介绍:
1.远程登录(用户名和密码超过3位长度则成功,在服务器可以自己设置代码)
2.含有loading效果(多线程处理,时事返回数据)
3.登录不成功能够提示出错原因
4.保存登錄后的信息(如用戶名和密碼,可以自己設置)
5.具有超级完整详细的注释(新手也能看懂)
可以设置成自己的UI库
注意:
1.需要设置androidManifest文件
<activity android:name=".IndexPage" android:label="登陆后的页面" /><activity android:name=".Register" android:label="注册" /> </application><uses-permission android:name="android.permission.INTERNET" />
2.需要编写一个服务器servlet代码 String userName = request.getParameter("userName");String password = request.getParameter("password");System.out.println(userName+"-"+password);DataOutputStream dos = new DataOutputStream(response.getOutputStream());if (userName != null && password != null) {if (userName.length() > 3 && password.length() > 3) {dos.writeInt(16);}else{dos.writeInt(0);}} else {dos.writeInt(0);}dos.flush();dos.close();
3.别望了配置web.xml(如果是jsp则可以不用配置)
4.需要在Login.class中的内部类LoginFailureHandler的run方法中的validateURL(验证用户名和密码的URL)




附件上传:
转载:http://www.adobex.com/android/source/details/00000361.htm