You don't respond to the HOME key, it is handled by the OS
and only by the OS.  Add android:clearTaskOnLaunch to your
top-level <activity> tag in the manifest, and the OS does
what you describe.

http://developer.android.com/guide/topics/manifest/activity-element.html

On Feb 16, 7:00 am, Abhilash baddam
<[email protected]> wrote:
> Hi,
>
>    How to handle the Home key functionality. Suppose in my app i am having 5
> activities. When the user in 3rd activity if he clicks on Home button i want
> to finish my app. If he starts the app again then i want to start the app
> from starting onwards.
>
> I did like this but its not working,
>
> public boolean onKeyDown(int keyCode, KeyEvent event) {
>     if ((keyCode == KeyEvent.KEYCODE_HOME)) {
>      //webView.goBack();
>      System.out.println("HOME in TEstApps");
>      finish();
>         return true;
>     }
>     return super.onKeyDown(keyCode, event);
>
>
>
>
>
>
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to