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);
    }


1 comment:

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.