我正在尝试达到当前的活动。下面的代码来自其他示例,编辑后具有当前活动的正确名称。但是我如何从那里得到实际的实例呢?
ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
// get the info from the currently running task
List< ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(1);
ComponentName componentInfo = taskInfo.get(0).topActivity;
// this is the class-name
componentInfo.getClassName();
谢谢,马库斯