找回密码
 立即注册
theLogin登录服务器 | android开发 2022-11-07 51 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
带Loading效果的Android远程登录代码+实例,关于在后台恳求服务器是否登录成功,回来[0]登录状况,[1]是否网络错误。代码中可以学习到很多Android编程的小技巧,比方弹出对话框、初始化注册view组件、清空监听按钮、检测注册表单等。实现关键:1.远程登录(用户名和密码超越3位长度则成功,在服务器可以自己设置代码)2.含有loading效果(多线程管理,时势回来数据)3.登录不成功可以提示犯错原因4.保存登錄后的信息(如用戶名和密碼,可以自己設置)注意:1.需求设置androidManifest文件2.需求编写一个服务器servlet代码3.别望了配置web.xml(假如是jsp则可以不必配置)4.需求在Login.class中的内部类LoginFailureHandler的run方法中的validateURL检测用户登陆,服务器通过DataOutputStream的dos.writeInt(int);来判别是否登录成功(服务器回来intgt;0登陆成功,否则失败),登陆成功后依据isRememberMe来判别是否保存密码(用户名是会保存的),假如连接服务器超越5秒,也算连接失败.

(Android remote login code instance with loading effect, about whether the server is successfully logged in in the background, [0] login status, [1] network error. You can learn many Android programming tips in the code, such as pop up dialog boxes, initialize the registration view component, clear the listening button, and check the registration form. Implementation keys: 1. Remote login (if the user name and password exceed 3 bits, it is successful, and you can set the code on the server) 2. It contains the loading effect (multi-threaded management, and the data returned by the situation) 3. If the login is unsuccessful, you can prompt the reason for the error 4. Save the information after login (such as the user name and password, you can set them yourself) Note: 1. You need to set the androidManifest file 2. You need to write a server servlet code 3. Don't look at configuring web.xml (If it is a jsp, you do not need to configure it) 4. The requirements are in Login The validateURL in the run method of the internal class LoginFailureHandler in class detects the user's login. The server uses the dos of DataOutputStream writeInt(int); To determine whether the login is successful (if the server returns intgt; 0, the login is successful; otherwise, the login fails). After the login is successful, determine whether to save the password according to isRememberMe (the user name will be saved). If the connection to the server lasts more than 5 seconds, the connection is also considered as a failure)

[下载]13470436837.rar




上一篇:android城市适时天气预报程序
下一篇:Android aidl跨进程调用源码例子+详解