开发者

HTC Devices Back Button issue..?

I am developing an app in which i am using custom list tab,By using this custom list tab i am rendering some child activities, and some of the child activities are having some soft key pad functionality now the problem is when i click on the back hard key(when the soft key pad is on) it is simply kil开发者_开发技巧ling the activity with out firing OnkeyDown() and onBackpress() events and it is firing onDestroy() event method and this issue is specially occurring in HTC Devices. And the other devices(samsung) are working as exppect i.e. hiding the soft key pas on pressing hard back key. how to this issue?

Thanks, Ram.


You can try overriding onKeyDown and onKeyUp like this:

@Override
public boolean onKeyDown( int keyCode, KeyEvent event )
{
    if ( keyCode == KeyEvent.KEYCODE_BACK )
    {
        return true;
    }
    return super.onKeyDown( keyCode, event );
}

@Override
public boolean onKeyUp( int keyCode, KeyEvent event )
{
    if ( keyCode == KeyEvent.KEYCODE_BACK )
    {
        onBackPressed();
        return true;
    }
    return super.onKeyUp( keyCode, event );
}

I remember reading this to be a problem in Android versions earlier than 2.1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜