Android Utils
1,Android获得当前正在显示的activity类名的方法:
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> runningTasks = manager .getRunningTasks(1);
RunningTaskInfo cinfo = runningTasks.get(0);
ComponentName component = cinfo.topActivity;
Log.e("current activity is ", component.getClassName());
List<RunningTaskInfo> runningTasks = manager .getRunningTasks(1);
RunningTaskInfo cinfo = runningTasks.get(0);
ComponentName component = cinfo.topActivity;
Log.e("current activity is ", component.getClassName());