如何在复合控制中检测应用程序何时到达前台

时间:2013-10-07 21:06:08

标签: android

我正在使用主要活动中包含的复合控件:

<com.example.test.StatusBar
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="#FF333333" />

和那个类是

public class StatusBar extends LinearLayout

当我的应用程序转到后台/前台时,我现在想在StatusBar类中获取一个事件。事件onPause(), onResume() ...在这种情况下不起作用,因为它们只存在于一个Activity上,而我已经使用LinearLayout扩展了我的类 我也不想从活动中转发这些事件,因为我在每个活动上显示此状态栏。

有机会获得这些活动吗?

感谢您的帮助。

菲利普

编辑:API版本为14

Edit2:似乎不可能:http://www.vogella.com/articles/AndroidCustomViews/article.html - 2.3。活动生命周期

0 个答案:

没有答案
相关问题