In my Android application I need to validate user entered data. So I have used if block to do that. If user entered data is invalid I want to stop running the activity further. How to do this within if block I tried to use System.exit(0) but it didn’t work for me.
I don’t know whether there is proper way to do this without using if statements please help me.
E.g.:
if(!uName.equals("User")) {
// Here I want to terminate the activity
}
Simply call
finish().