what is the code for the default action of the 'back' button in android?
<p>I have an edittext and a save button displayed. When back key is pressed, I want them to be gone (if they are visible) and the next back press will do the default action of the back button.
The code is as follows:</p>

<pre><code>public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK
                &amp;&amp; event.getRepeatCount() == 0) {
            event.startTracking();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; event.isTracking()
                &amp;&amp; !event.isCanceled()) {
            if(save.isShown())
            {
                 save.setVisibility(Button.GONE);
                 text.setVisibility(EditText.GONE);
            }
                    //else ???????????????

            return true;
        }
        return super.onKeyUp(keyCode, event);
    }   
</code></pre>

<p>The above code has following outcomes:
1. when edittext and button is visible, then back button makes them gone but the following press renders nothing. Although if back button is kept pressed, we go back to the previous activity.
2. when edittext and button are initially not there, pressing of back button stops the application unexpectedly.Although if back button is kept pressed, we go back to the previous activity.</p>

<p>In the place of else, I have tried finish() but the program is stopping unexpectedly.
return false also results same..</p>
