How to go back to the last accessed activity?
<pre><code>    back = (Button) findViewById(R.id.back);
    back.setOnClickListener(new View.OnClickListener() {    
        public void onClick(View v1) {
            Intent setIntent = new Intent(Intent.ACTION_MAIN);
            setIntent.addCategory(Intent.CATEGORY_HOME);
            setIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(setIntent); 
        }
    });
</code></pre>

<p>I have created a back button in my application and once the user click on the back button, it will go back to the last accessed activity, but when i click back button, it brings me to exit the apps... what is wrong with the code?</p>
