try this

public boolean onKeyDown(int keyCode, KeyEvent event) {

    if (keyCode == KeyEvent.KEYCODE_BACK) {
      super.onKeyDown(keyCode, event)
      do something
        return true;
    }
    return false;
}


On Jan 11, 5:14 pm, vani reddy <[email protected]> wrote:
> Thanks.
> I tried this , the problem is onKeyDown is never fired
>
> On Wed, Jan 11, 2012 at 5:41 PM, Ratheesh Valamchuzhy
> <[email protected]>wrote:
>
>
>
>
>
>
>
>
>
> > try this
>
> > public boolean onKeyDown(int keyCode, KeyEvent event) {
> >     if (keyCode == KeyEvent.KEYCODE_BACK) {
> >         moveTaskToBack(true);
> >         return true;
> >     }
> >     return super.onKeyDown(keyCode, event);
> >  }
> >     public void backButtonPressed(View v) {
> >     //do this
>
> >  }
>
> > --
> > 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
>
> --
> Regards,
> Vani Reddy

-- 
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