美文网首页
moveTaskToBack

moveTaskToBack

作者: qpan | 来源:发表于2018-03-20 10:58 被阅读179次
    • 场景:
      希望点击返回键时,当前页面不退出,而是app退到后台等

    • class Activity function: public boolean moveTaskToBack(boolean nonRoot)

    /**
         * Move the task containing this activity to the back of the activity
         * stack.  The activity's order within the task is unchanged.
         *
         * @param nonRoot If false then this only works if the activity is the root
         *                of a task; if true it will work for any activity in
         *                a task.
         *
         * @return If the task was moved (or it was already at the
         *         back) true is returned, else false.
         */
        public boolean moveTaskToBack(boolean nonRoot) {
            try {
                return ActivityManager.getService().moveActivityTaskToBack(
                        mToken, nonRoot);
            } catch (RemoteException e) {
                // Empty
            }
            return false;
        }
    

    相关文章

      网友评论

          本文标题:moveTaskToBack

          本文链接:https://www.haomeiwen.com/subject/mjpvqftx.html