android - overriding the back button
<p>I have a <code>webView</code> inside an Activity's layout. If back button is pressed, I want that view to disappear and other views to become visible, to I did the following:</p>

<pre><code>    @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; web.getVisibility()==View.VISIBLE) {
        restoreInitalState(); // set Visibility of Views
        APP_CONSTANTS.LOGIN_OP_CANCELLED(getApplicationContext()); // inform the user that the current operation was cancelled
    }
    return super.onKeyDown(keyCode, event);

}
</code></pre>

<p>it works BUT it finishes the Activity immediately after calling my methods, like if the back button was pressed 2 times. I need to keep the current Activity and just call my methods mentioned above. Any suggestions?</p>
