如何知道黑莓中哪个屏幕打开/在前台?换句话说,我们能否获取当前在 BB 中打开的屏幕的名称。它可以包括其他应用程序、通话记录、消息等,不一定是我的应用程序。这可以做到吗?谢谢..
最佳答案
ApplicationDescriptor 中有三个方法可以帮助您找出当前前台的应用程序。获取 Application 对象本身可能有点困难,但您至少可以发现 ApplicationDescriptor。
ApplicationManager mgr = ApplicationManager.getApplicationManager();
final ApplicationDescriptor[] vApps = mgr.getVisibleApplications();
int foregroundId = mgr.getForegroundProcessId();
for(int i = 0; i < vApps.length; i++) {
int id = mgr.getProcessId(vApps[i]);
if(id == foregroundId) {
// we have a winner!
}
}
关于java - 如何知道黑莓手机中哪个屏幕打开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12406348/