Android打开最近任务列表代码

  |   0 评论   |   121 浏览

    Class serviceManagerClass;
    try {
        serviceManagerClass = Class.forName("android.os.ServiceManager");
      Method getService = serviceManagerClass.getMethod("getService",
      String.class);
      IBinder retbinder = (IBinder) getService.invoke(
                serviceManagerClass, "statusbar");
      Class statusBarClass = Class.forName(retbinder
                .getInterfaceDescriptor());
      Object statusBarObject = statusBarClass.getClasses()[0].getMethod(
                "asInterface", IBinder.class).invoke(null,
     new Object[]{retbinder});
      Method clearAll = statusBarClass.getMethod("toggleRecentApps");
      clearAll.setAccessible(true);
      clearAll.invoke(statusBarObject);
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    知识共享许可协议

    评论

    发表评论

    validate