I am using cocos2dx to make a small game and in the activity of my game i give the following functions to handle back button.
@Override public boolean onKeyDown
To handle back button pressing you need to redefine onBackPressed() method of your activity, not this two methods.
onBackPressed()