/**
* 获取栈顶的activity
* @param context
* @return
*/
public static String getTopActivity(Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> runningTaskInfos = manager.getRunningTasks(1);
if (runningTaskInfos != null)
return runningTaskInfos.get(0).topActivity.getClassName();
else
return "";
}
获取栈顶的activity
最新推荐文章于 2022-02-24 14:22:18 发布