不工作里面的ActivityGroup

不工作里面的ActivityGroup

本文介绍了onBack pressed()不工作里面的ActivityGroup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个的ActivityGroup 里面,而我有一个活动。我有 overrided onBack pressed()本次活动。但不幸的是我的 onBack pressed()不会被调用。所以,我试着用的onkeydown()。但是,没有任何影响。我的问题是,我已经给了的ActivityGroup 需要控制在 onBack pressed()事件。如何重写返回preSS事件中我的子活动?

I have an ActivityGroup inside of which I have an Activity. I have overrided the onBackPressed() in this Activity. But unfortunately my onBackPressed() is not being called. So I tried with onKeyDown(). But no effect at all. My problem is, the onBackPressed() event which I have given in the ActivityGroup takes control. How to override the Back Press event inside my sub Activity?

任何帮助是AP preciated。

Any help is appreciated.

推荐答案

我只是有这个同样的问题,我通过调用解决了当前活动的onBack pressed从的ActivityGroup:

I just had this same problem and I solved it by calling the current activity's onBackPressed from the ActivityGroup:

@Override
public void onBackPressed()
{
    int length = idList.size();
    if (length > 1)
    {
        Activity current = getLocalActivityManager().getActivity(
            idList.get(length - 1));
        current.onBackPressed();
    }
}

IDLIST是活动的活动组在列表中。

idList is a list of activities in the activity group.

这篇关于onBack pressed()不工作里面的ActivityGroup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:14