2012-07-24 65 views

回答

1

使用ActivityManager

ActivityManager mManager = (ActivityManager)getSystemService(UpdateService.ACTIVITY_SERVICE); 
List<ActivityManager.RunningTaskInfo> myTasks = activityManager.getRunningTasks(1); 

ForegroundActivity => myTasks.get(0).topActivity.getPackageName(); 
相關問題