我正在努力达到目前的活动。下面的代码来自其他一些示例,编辑后具有正确的当前活动名称。但是如何从那里获得实际的实例?
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();
感谢名单, 马库斯