1. 程式人生 > >判斷當前介面是不是桌面

判斷當前介面是不是桌面

 /**
      * 判斷當前介面是否是桌面
      */
     private boolean isHome() {
         ActivityManager mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
         List<RunningTaskInfo> rti = mActivityManager.getRunningTasks(1);
         return getHomes().contains(rti.get(0).topActivity.getPackageName());
     }