有人可以帮助我吗?我试图创建登录屏幕。首先要做的是输入一个电话号码,然后再打电话给另一个屏幕(如果该号码尚未注册,它将重定向到注册屏幕,否则它将重定向到密码屏幕输入他的密码。)
答案 0 :(得分:0)
试试这个......
`EditText MobileNumber ;
MobileNumber = (EditText) findViewById(R.id.MobileNumber);
MobileNumber.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
if(arg0.length()== 10)
{
first check here the phone no is already registered or not
if(phoneregistered==true){
Intent intent = new Intent(context, Password.class);
startActivity(intent);
}
else{
Intent intent1 = new Intent(context, Registration.class);
startActivity(intent1);
}
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
}
@Override
public void afterTextChanged(Editable arg0) {
}
});
希望这会对你有帮助..
答案 1 :(得分:0)
使用以下方法,只需传递号码和项目的班级名称
即可public void redirectNextScreen(String phoneNumber){
if(!phoneNumber.isEmpty()){
// check number is registered
if(isRegistered){
Intent intent = new Intent(//your current activity.this, PasswordActivity.class);
startActivity();
finish();
}
else{
Intent intent = new Intent(//your current activity.this, RegisterationActivity.class);
startActivity();
finish();
}
}
}