我已经制作了 .NET Web 服务,到目前为止,我的 android 应用程序可以与我的 Web 服务进行通信。现在,我想制作一个登录表单,但我对来自 Web 服务的值感到困惑。
这是我的登录代码:
// Login button Click Event
btnLogin.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
try
{
inputUser = (EditText) findViewById(R.id.loginUser);
inputPassword = (EditText) findViewById(R.id.loginPassword);
String user = inputUser.getText().toString();
String password = inputPassword.getText().toString();
hasil = "START";
Panggil call = new Panggil();
call.user = user;
call.password = password;
call.join();
call.start();
while (hasil.equals("START")){
try{
Thread.sleep(10);
}
catch (Exception ex){
}
}
if (hasil != ""){
loginErrorMsg.setText("");
// Launch Dashboard Screen
// Send User Full Name to Dashboard Screen
Intent dashboard = new Intent(getApplicationContext(), DashboardActivity.class);
dashboard.putExtra("myname", hasil);
// Close all views before launching Dashboard
dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(dashboard);
// Close Login Screen
finish();
}
else{
// Error in login
loginErrorMsg.setText("Incorrect username/password");
}
}
catch(Exception ex)
{
ad.setTitle("Error!");
ad.setMessage(ex.toString());
ad.show();
}
}
});
从该登录代码中,我得到如下值hasil
:
anyType{ccduser=myusername; password=123456}
如何提取或解析该值并将其IF..ELSE..
用作登录条件?