HTC设备后退按钮问题..? [英] HTC Devices Back Button issue..?

查看:95
本文介绍了HTC设备后退按钮问题..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个应用程序中,我使用自定义列表选项卡中,通过使用这种自定义列表选项卡我正在呈现一些子活动,有的孩子活动是有一些软键盘功能,现在的问题是,当我点击在后面硬键(当软键盘上),它只是杀死活性出来射击的onkeydown()和onBack preSS()事件,它是射击的onDestroy()事件方法这个问题是特别发生在HTC设备。和其他设备(三星)正在为exppect即躲在$ P $软键PAS pssing硬返回键。怎么这个问题?

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

推荐答案

您可以尝试重写onKeyDown和的onkeyup这样的:

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

我记得读这是Android的版本比2.1更早问题

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

这篇关于HTC设备后退按钮问题..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆