Tuesday, 17 July 2012

Android Tutorial: KeyEvent

This tutorial will show you how to handle when a user press the Back key.

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
        // IF CLICK BACK BUTTON
        if (keyCode == KeyEvent.KEYCODE_BACK)
        {
            //INSTRUCT WHAT HAPPEN HERE
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }


2 comments:

iCaption That said...

I agree with your blog.I am going to use some new resources and tell my developers about the others.Thanks for sharing!!
iCaption That

Hire Android App Developer said...

Hey thanks for the code. It will very helpful to me in future. This post is related with what I’m concerned with and it’s fantastically made.