I've made .NET web service, so far my android application can communicate with my web service. Now, I want to make a login form, and I'm confuse with the values from my web service.
Here is my code for login:
// 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();
}
}
});
From that login code, I get the value for hasil like this:
anyType{ccduser=myusername; password=123456}
How to extract or parsing that value and use it for IF..ELSE.. condition for login?