从网络读取数据达到登录和注册的功能
2016-08-07 15:43
423 查看
一、使用Bmob网站,进行网络存储
二、登录界面的界面
三、布局文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff"
android:orientation="vertical"
tools:context=".LoginActivity" >
<ImageView
android:id="@+id/imageview_login_logo"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="18dp"
android:background="@drawable/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="用户名"
android:textColor="#ff1196db"
android:textSize="12sp" />
<EditText
android:id="@+id/edittext_login_user"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@drawable/line"
android:hint="用户名:"
android:paddingLeft="5dp"
android:textColor="#ff000000"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingLeft="5dp"
android:text="密码:"
android:textColor="#ff1196db"
android:textSize="12sp" />
<EditText
android:id="@+id/edittext_login_pwd"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@drawable/line"
android:hint="密码"
android:password="true"
android:paddingLeft="5dp"
android:textColor="#ff000000"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkbox_login_forgetpwd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox"
android:gravity="center"
android:text="记住密码"
android:textColor="#ff1196db" />
<CheckBox
android:id="@+id/checkbox_login_autologin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox"
android:gravity="center"
android:text="自动登录"
android:textColor="#ff1196db" />
</LinearLayout>
<Button
android:id="@+id/button_login_login"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:background="@drawable/selector_login_btn"
android:text="登 录"
android:textColor="#ffffffff"
android:textSize="18dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="12sp" >
<Button
android:id="@+id/button_login_cannotLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#00000000"
android:text="无法登录?"
android:textColor="#ff1196db"
android:textSize="15sp" />
<Button
android:id="@+id/button_login_registerUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#00000000"
android:text="注册新用户"
android:textColor="#ff1196db"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
四、java代码
除了从网络提取数据,还有各种细节的也可以一下
功能:
1.保存用户名和密码
2.自动登录
3.从网络检查用用户是否存在
public class LoginActivity extends Activity {
private Button login,registerUser,cannotLogin;
private EditText user,pwd;
private CheckBox forgetPwd,autoLogin;
private Dialog dialog ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bmob.initialize(this, "b527798f489b995401c9498d59455455");
setContentView(R.layout.activity_login);
initialize();
setLoginButton();
setRegisterUser();
setAutoLogin();
}
//自动登录按键
private void setAutoLogin() {
autoLogin.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(autoLogin.isChecked()){
forgetPwd.setChecked(true);
}
}
});
}
private void initialize() {
forgetPwd = (CheckBox) findViewById(R.id.checkbox_login_forgetpwd);
autoLogin = (CheckBox) findViewById(R.id.checkbox_login_autologin);
login = (Button) findViewById(R.id.button_login_login);
registerUser = (Button) findViewById(R.id.button_login_registerUser);
cannotLogin = (Button) findViewById(R.id.button_login_cannotLogin);
user = (EditText) findViewById(R.id.edittext_login_user);
pwd = (EditText) findViewById(R.id.edittext_login_pwd);
SharedPreferences sp = getSharedPreferences("key", Context.MODE_PRIVATE);
boolean checked = sp.getBoolean("ischeck", false);
boolean autoLogin_check = sp.getBoolean("autoLogin", false);
autoLogin.setChecked(autoLogin_check);
Log.i("TAG:autoLogin_check1", "autoLogin_check="+autoLogin_check);
//判断是否自动登录
if(autoLogin.isChecked()){
dialog = DialogManage.showRunLogin(LoginActivity.this);
dialog.show();
startActivity(new Intent(LoginActivity.this,MainActivity.class));
finish();
}
Log.i("TAG:check1", "check="+checked);
if(checked){
user.setText(sp.getString("user_name", ""));
pwd.setText(sp.getString("user_pwd", ""));
forgetPwd.setChecked(true);
}else{
user.setText(sp.getString("user_name", ""));
forgetPwd.setChecked(false);
}
}
private void setLoginButton() {
login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
BmobQuery<Users> query = new BmobQuery<Users>();
query.addWhereContains("loginUser", user.getText().toString());
query.findObjects(LoginActivity.this, new FindListener<Users>() {
@Override
public void onSuccess(List<Users> users) {
SharedPreferences sp = getSharedPreferences("key", Context.MODE_PRIVATE);
Editor editor = sp.edit();
String user_name = user.getText().toString();
String user_pwd = pwd.getText().toString();
boolean frogetPwd_checked = forgetPwd.isChecked();
boolean autoLogin_checked = autoLogin.isChecked();
if(users.size()>0){
if(user.getText().toString().equals(users.get(0).getLoginUser())&&
pwd.getText().toString().equals(users.get(0).getLoginPwd())){
if(frogetPwd_checked){
if(autoLogin_checked){
editor.putString("user_name", user_name);
editor.putString("user_pwd", user_pwd);
editor.putBoolean("ischeck", true);
editor.putBoolean("autoLogin", true);
}else{
editor.clear();
editor.putString("user_name", user_name);
editor.putString("user_pwd", user_pwd);
editor.putBoolean("ischeck", true);
editor.putBoolean("autoLogin", false);
}
}else{
editor.clear();
editor.putString("user_name", user_name);
editor.putBoolean("isckeck", false);
}
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
intent.putExtra("loginName", user_name);
intent.putExtra("loginPwd", user_pwd);
intent.putExtra("isChecked", true);
startActivity(intent);
editor.putBoolean("isLogin", true);
editor.commit();
finish();
}
}else if(user.getText().toString().equals(users.get(0).getLoginUser())){
pwd.setText("");
pwd.setError("密码错误,请检查是否输入正解,重新输入");
}else{
user.setError("没有此用户,请先注册");
}
}
@Override
public void onError(int arg0, String arg1) {
Log.i("TAG:erro", arg1);
}
});
}
});
}
//注册新用户点击事件
private void setRegisterUser() {
registerUser.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
registerUser.setTextColor(Color.parseColor("#ffafafaf"));
break;
case MotionEvent.ACTION_UP:
registerUser.setTextColor(Color.parseColor("#ff1196db"));
Intent intent = new Intent(LoginActivity.this,RegisterActivity.class);
startActivity(intent);
break;
}
return true;
}
});
}
private boolean checkLogin(String username,String userpwd,String path) {
boolean flag = false;
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(path);
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
NameValuePair name1 = new BasicNameValuePair("username",username);
NameValuePair name2 = new BasicNameValuePair("userpwd", userpwd);
pairs.add(name1);
pairs.add(name2);
HttpEntity entity;
try {
entity = new UrlEncodedFormEntity(pairs);
post.setEntity(entity);
HttpResponse response = client.execute(post);
if(response.getStatusLine().getStatusCode() == 200){
HttpEntity entity2 = response.getEntity();
String jsonStr = EntityUtils.toString(entity2);
JSONObject jsonObject = new JSONObject(jsonStr);
String result = jsonObject.getString("result");
if(result.equals("ok")){
flag = true;
}else{
flag = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return flag;
}
private void loginHttp() {
final String path = "http://172.60.16.49:8080/WebTest/DoLogin";
final String user_name = user.getText().toString();
final String user_pwd = pwd.getText().toString();
new Thread(new Runnable() {
@Override
public void run() {
final boolean flag =
checkLogin(user_name, user_pwd, path);
LoginActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if(flag){
startActivity(new Intent(LoginActivity.this,MainActivity.class));
}else{
Toast.makeText(LoginActivity.this, "请检查用户名密码是否正确", 1000).show();
}
}
});
}
}).start();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
五、注册实现
功能比较简单
功能界面
注册界面比较简单就不传代码了,直接传完成注册的代码了(注册的功能也在完成注册的);
实现的功能:
1.实现贴 自动递增加
2.比对验证码是否正确
public class RegisterSuccessActivity extends Activity {
private TextView user,pwd;
private Button jumpLogin;
private EditText auth;
private int count;
String rand;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bmob.initialize(RegisterSuccessActivity.this, "b527798f489b995401c9498d59455455");
setContentView(R.layout.activity_register_success);
initView();
statisty();
setListener();
}
private void initView() {
user = (TextView) findViewById(R.id.tv_registerSuceess_user);
pwd = (TextView) findViewById(R.id.tv_registerSuceess_pwd);
auth = (EditText) findViewById(R.id.et_registerSuceess_authcode);
jumpLogin = (Button) findViewById(R.id.button_registerSuceess_login);
Intent intent = getIntent();
rand = intent.getStringExtra("rand");
Log.i("TAG:rand", rand);
Toast.makeText(RegisterSuccessActivity.this, rand, Toast.LENGTH_LONG).show();
}
private void statisty() {
BmobQuery<Users> query = new BmobQuery<Users>();
query.addQueryKeys("objectId");
query.findObjects(RegisterSuccessActivity.this, new FindListener<Users>() {
@Override
public void onSuccess(List<Users> users) {
count = users.size();
Log.i("TAG:count", count+"");
int n = 100000;
count = n+(count++);
user.setText(String.valueOf(count));
Random random = new Random();
char[] chars = new char[8];
for (int i = 0; i < chars.length; i++) {
chars[i] = (char) (random.nextInt(26)+97);
}
String randPwd = String.valueOf(chars);
pwd.setText(randPwd);
}
@Override
public void onError(int arg0, String arg1) {
}
});
}
private void setListener(){
jumpLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(auth.getText().toString().equals(rand)){
Users users = new Users();
users.setLoginUser(user.getText().toString());
users.setLoginPwd(pwd.getText().toString());
users.save(RegisterSuccessActivity.this, new SaveListener() {
@Override
public void onSuccess() {
Log.i("TAG:success", "注册成功");
Intent intent = new Intent(RegisterSuccessActivity.this,MainActivity.class);
startActivity(intent);
}
@Override
public void onFailure(int arg0, String arg1) {
Log.i("TAG:error", arg1);
}
});
}else{
auth.setText("");
auth.setError("验证码不正确,请重新输入");
}
}
});
}
}
二、登录界面的界面
三、布局文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff"
android:orientation="vertical"
tools:context=".LoginActivity" >
<ImageView
android:id="@+id/imageview_login_logo"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="18dp"
android:background="@drawable/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="用户名"
android:textColor="#ff1196db"
android:textSize="12sp" />
<EditText
android:id="@+id/edittext_login_user"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@drawable/line"
android:hint="用户名:"
android:paddingLeft="5dp"
android:textColor="#ff000000"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingLeft="5dp"
android:text="密码:"
android:textColor="#ff1196db"
android:textSize="12sp" />
<EditText
android:id="@+id/edittext_login_pwd"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@drawable/line"
android:hint="密码"
android:password="true"
android:paddingLeft="5dp"
android:textColor="#ff000000"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkbox_login_forgetpwd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox"
android:gravity="center"
android:text="记住密码"
android:textColor="#ff1196db" />
<CheckBox
android:id="@+id/checkbox_login_autologin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox"
android:gravity="center"
android:text="自动登录"
android:textColor="#ff1196db" />
</LinearLayout>
<Button
android:id="@+id/button_login_login"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:background="@drawable/selector_login_btn"
android:text="登 录"
android:textColor="#ffffffff"
android:textSize="18dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="12sp" >
<Button
android:id="@+id/button_login_cannotLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#00000000"
android:text="无法登录?"
android:textColor="#ff1196db"
android:textSize="15sp" />
<Button
android:id="@+id/button_login_registerUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="#00000000"
android:text="注册新用户"
android:textColor="#ff1196db"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
四、java代码
除了从网络提取数据,还有各种细节的也可以一下
功能:
1.保存用户名和密码
2.自动登录
3.从网络检查用用户是否存在
public class LoginActivity extends Activity {
private Button login,registerUser,cannotLogin;
private EditText user,pwd;
private CheckBox forgetPwd,autoLogin;
private Dialog dialog ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bmob.initialize(this, "b527798f489b995401c9498d59455455");
setContentView(R.layout.activity_login);
initialize();
setLoginButton();
setRegisterUser();
setAutoLogin();
}
//自动登录按键
private void setAutoLogin() {
autoLogin.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(autoLogin.isChecked()){
forgetPwd.setChecked(true);
}
}
});
}
private void initialize() {
forgetPwd = (CheckBox) findViewById(R.id.checkbox_login_forgetpwd);
autoLogin = (CheckBox) findViewById(R.id.checkbox_login_autologin);
login = (Button) findViewById(R.id.button_login_login);
registerUser = (Button) findViewById(R.id.button_login_registerUser);
cannotLogin = (Button) findViewById(R.id.button_login_cannotLogin);
user = (EditText) findViewById(R.id.edittext_login_user);
pwd = (EditText) findViewById(R.id.edittext_login_pwd);
SharedPreferences sp = getSharedPreferences("key", Context.MODE_PRIVATE);
boolean checked = sp.getBoolean("ischeck", false);
boolean autoLogin_check = sp.getBoolean("autoLogin", false);
autoLogin.setChecked(autoLogin_check);
Log.i("TAG:autoLogin_check1", "autoLogin_check="+autoLogin_check);
//判断是否自动登录
if(autoLogin.isChecked()){
dialog = DialogManage.showRunLogin(LoginActivity.this);
dialog.show();
startActivity(new Intent(LoginActivity.this,MainActivity.class));
finish();
}
Log.i("TAG:check1", "check="+checked);
if(checked){
user.setText(sp.getString("user_name", ""));
pwd.setText(sp.getString("user_pwd", ""));
forgetPwd.setChecked(true);
}else{
user.setText(sp.getString("user_name", ""));
forgetPwd.setChecked(false);
}
}
private void setLoginButton() {
login.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
BmobQuery<Users> query = new BmobQuery<Users>();
query.addWhereContains("loginUser", user.getText().toString());
query.findObjects(LoginActivity.this, new FindListener<Users>() {
@Override
public void onSuccess(List<Users> users) {
SharedPreferences sp = getSharedPreferences("key", Context.MODE_PRIVATE);
Editor editor = sp.edit();
String user_name = user.getText().toString();
String user_pwd = pwd.getText().toString();
boolean frogetPwd_checked = forgetPwd.isChecked();
boolean autoLogin_checked = autoLogin.isChecked();
if(users.size()>0){
if(user.getText().toString().equals(users.get(0).getLoginUser())&&
pwd.getText().toString().equals(users.get(0).getLoginPwd())){
if(frogetPwd_checked){
if(autoLogin_checked){
editor.putString("user_name", user_name);
editor.putString("user_pwd", user_pwd);
editor.putBoolean("ischeck", true);
editor.putBoolean("autoLogin", true);
}else{
editor.clear();
editor.putString("user_name", user_name);
editor.putString("user_pwd", user_pwd);
editor.putBoolean("ischeck", true);
editor.putBoolean("autoLogin", false);
}
}else{
editor.clear();
editor.putString("user_name", user_name);
editor.putBoolean("isckeck", false);
}
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
intent.putExtra("loginName", user_name);
intent.putExtra("loginPwd", user_pwd);
intent.putExtra("isChecked", true);
startActivity(intent);
editor.putBoolean("isLogin", true);
editor.commit();
finish();
}
}else if(user.getText().toString().equals(users.get(0).getLoginUser())){
pwd.setText("");
pwd.setError("密码错误,请检查是否输入正解,重新输入");
}else{
user.setError("没有此用户,请先注册");
}
}
@Override
public void onError(int arg0, String arg1) {
Log.i("TAG:erro", arg1);
}
});
}
});
}
//注册新用户点击事件
private void setRegisterUser() {
registerUser.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
registerUser.setTextColor(Color.parseColor("#ffafafaf"));
break;
case MotionEvent.ACTION_UP:
registerUser.setTextColor(Color.parseColor("#ff1196db"));
Intent intent = new Intent(LoginActivity.this,RegisterActivity.class);
startActivity(intent);
break;
}
return true;
}
});
}
private boolean checkLogin(String username,String userpwd,String path) {
boolean flag = false;
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(path);
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
NameValuePair name1 = new BasicNameValuePair("username",username);
NameValuePair name2 = new BasicNameValuePair("userpwd", userpwd);
pairs.add(name1);
pairs.add(name2);
HttpEntity entity;
try {
entity = new UrlEncodedFormEntity(pairs);
post.setEntity(entity);
HttpResponse response = client.execute(post);
if(response.getStatusLine().getStatusCode() == 200){
HttpEntity entity2 = response.getEntity();
String jsonStr = EntityUtils.toString(entity2);
JSONObject jsonObject = new JSONObject(jsonStr);
String result = jsonObject.getString("result");
if(result.equals("ok")){
flag = true;
}else{
flag = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return flag;
}
private void loginHttp() {
final String path = "http://172.60.16.49:8080/WebTest/DoLogin";
final String user_name = user.getText().toString();
final String user_pwd = pwd.getText().toString();
new Thread(new Runnable() {
@Override
public void run() {
final boolean flag =
checkLogin(user_name, user_pwd, path);
LoginActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if(flag){
startActivity(new Intent(LoginActivity.this,MainActivity.class));
}else{
Toast.makeText(LoginActivity.this, "请检查用户名密码是否正确", 1000).show();
}
}
});
}
}).start();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
五、注册实现
功能比较简单
功能界面
注册界面比较简单就不传代码了,直接传完成注册的代码了(注册的功能也在完成注册的);
实现的功能:
1.实现贴 自动递增加
2.比对验证码是否正确
public class RegisterSuccessActivity extends Activity {
private TextView user,pwd;
private Button jumpLogin;
private EditText auth;
private int count;
String rand;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bmob.initialize(RegisterSuccessActivity.this, "b527798f489b995401c9498d59455455");
setContentView(R.layout.activity_register_success);
initView();
statisty();
setListener();
}
private void initView() {
user = (TextView) findViewById(R.id.tv_registerSuceess_user);
pwd = (TextView) findViewById(R.id.tv_registerSuceess_pwd);
auth = (EditText) findViewById(R.id.et_registerSuceess_authcode);
jumpLogin = (Button) findViewById(R.id.button_registerSuceess_login);
Intent intent = getIntent();
rand = intent.getStringExtra("rand");
Log.i("TAG:rand", rand);
Toast.makeText(RegisterSuccessActivity.this, rand, Toast.LENGTH_LONG).show();
}
private void statisty() {
BmobQuery<Users> query = new BmobQuery<Users>();
query.addQueryKeys("objectId");
query.findObjects(RegisterSuccessActivity.this, new FindListener<Users>() {
@Override
public void onSuccess(List<Users> users) {
count = users.size();
Log.i("TAG:count", count+"");
int n = 100000;
count = n+(count++);
user.setText(String.valueOf(count));
Random random = new Random();
char[] chars = new char[8];
for (int i = 0; i < chars.length; i++) {
chars[i] = (char) (random.nextInt(26)+97);
}
String randPwd = String.valueOf(chars);
pwd.setText(randPwd);
}
@Override
public void onError(int arg0, String arg1) {
}
});
}
private void setListener(){
jumpLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(auth.getText().toString().equals(rand)){
Users users = new Users();
users.setLoginUser(user.getText().toString());
users.setLoginPwd(pwd.getText().toString());
users.save(RegisterSuccessActivity.this, new SaveListener() {
@Override
public void onSuccess() {
Log.i("TAG:success", "注册成功");
Intent intent = new Intent(RegisterSuccessActivity.this,MainActivity.class);
startActivity(intent);
}
@Override
public void onFailure(int arg0, String arg1) {
Log.i("TAG:error", arg1);
}
});
}else{
auth.setText("");
auth.setError("验证码不正确,请重新输入");
}
}
});
}
}
相关文章推荐
- iOS实战演练之关于数据交互的问题(利用XAMPP搭建本地服务器, 编写PHP代码实现iOS端注册登录功能)
- andriod开发利用MVP实现登录注册和加载网络数据
- hibernate分页查询,在自己写的s2sh注册登录的基础上添加对数据表的分页显示功能
- Android用SharedPreferences保存数据实现注册和登录功能(首次安装默认打开注册,记住密码)
- MVP注册登录+OkHttp网络请求+展示数据
- 基于XML的数据存储读取---实现的登录与注册
- 使用MVP注册登录模块+封装的OKhttp,拦截器+QQ第三方登录+RecyclerView+SpringView上拉加载下拉刷新网络数据
- andriod———1.实现原生登录注册。 2.首页完成商品列表展示点击相对应的商品ID进入商品详情 3.商品详情页面展示数据,点击加入购物车进入购物车页面 4.购物车页面完成购物车编辑,删除,功能
- 从网络请求数据,实现注册登录
- 使用leancloud实现登录注册,数据存储,即使通讯等功能
- 用Bmob实现注册和登录功能(网络存储)
- 登录以及注册功能的分析
- 基于Java NIO 异步读取网络数据
- 标准功能模块组件 -- “文档管理组件,网络文档管理,网络存储”,B\S版本组件可独立运行,也可集成到其他项目里,数据结构清晰思路严谨
- 读取网络数据时需要加上时延
- 回发或回调参数无效。在配置中使用 或在页面中使用 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
- AutoCompleteExtender实现自动完成功能(从数据库中读取数据 )
- 标准功能模块组件 -- “文档管理组件,网络文档管理,网络存储”,B/S版本组件可独立运行,也可集成到其他项目里,数据结构清晰思路严谨
- 回发或回调参数无效。在配置中使用 或在页面中使用 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。
- 一个使用监听器模式实现的J2ME网络编程框架,包括一个简单的登录功能实现(含源代码)