Android on back press user should remain in the same page
<p>In my activity page i have two option- normal screen and edit mode screen.Both screen are in the same activity.</p>

<p>When the user enters the activity the normal page is shown.when he clicks on a button the edit mode is shown.if normal screen is there then on back press user should go back to the previous activity.But if edit mode is on and the user clicks on back button then instead of going back to the previous activity,user should be shown the normal screen.</p>

<p>my onbackpressed method is </p>

<pre><code>if(inputSearch.getVisibility()== View.VISIBLE){     
        Intent intentList = new Intent(getApplicationContext(),listsActivity.class);
        intentList.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intentList);          
        }
        else{                   
            imgEditList.setSelected(false);
            editMode.setVisibility(View.GONE);
            inputSearch.setVisibility(View.VISIBLE);
        }       
        super.onBackPressed();
</code></pre>

<p>What is the use of finish().Does it close the present activity or...</p>
