private boolean inOBDActivity() {
ActivityManager am = (ActivityManager) this
.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> tasks = am.getRunningTasks(1);
if (!tasks.isEmpty()) {
ComponentName topActivity = tasks.get(0).topActivity;
return topActivity.getClassName().endsWith(
OBDMainActivity.class.getName());
}
return false;
}
Android判断当前的Activity
最新推荐文章于 2023-09-19 23:16:01 发布