Android : How to terminate activity using if block
<p>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 <code>System.exit(0)</code> 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.</p>

<p>Eg:</p>

<pre><code>  if(!uName.equals("User")){
    //Here I want to terminate the activity
}
</code></pre>

<p>Thanks!</p>
