我不确定这是否是您要寻找的东西,但这似乎很简单。http://iamvijayakumar.blogspot.com/2011/09/get-
current-activity-and-package-
name.html
ActivityManager am = (ActivityManager) this .getSystemService(ACTIVITY_SERVICE); List<RunningTaskInfo> taskInfo = am.getRunningTasks(1); ComponentName componentInfo = taskInfo.get(0).topActivity; Log.d(WebServiceHelper.TAG, "CURRENT Activity ::" + taskInfo.get(0).topActivity.getClassName()+" Package Name : "+componentInfo.getPackageName());
希望这可以帮助。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)