here's a part of my code: after button is clicked, new thread and connection to server are started. If connection is sucessfull, app should start new activity and end current. Can someone explain which way is best for to do that?
transThread.submit(new Runnable()
{
public void run()
{
guiProgressDialog(true);
if(user.length() < 4) guiNotifyUser("Username must have at least 4 characters!");
else if(pass.length() < 4) guiNotifyUser("Password must have at least 4 characters!");
else if(!pass.equals(passrtp)) guiNotifyUser("Password is not same in both fields!");
else if(!isValidEmail(mail)) guiNotifyUser("Your email is not valid email address!");
else if(fname.equals("") || lname.equals("")) guiNotifyUser("All fields are mandatory!");
else {
try {
final String message = AutoDiaryHttpHelper.signUp(user, md5(pass), mail, fname, lname);
guiNotifyUser(message);
//if message equals something start new activity
}
catch(Exception e) {
e.printStackTrace();
}
}
guiProgressDialog(false);
}
});
break;