android - How can I open a new activity inside of a new task and let it occur behind the current task? -
when using chrome on android 6.0, can long press link, select "open in new tab" , open task behind current task.
now need familiar, can't find out how let activity start inside new task , let task start behind current task fancy animation.
i found
public static final int anim_launch_task_behind = 7;
in activityoptions.java , there javadoc:
/** * if set along intent.flag_activity_new_document task being launched not * presented user instead available through recents task list. * in addition, new task wil affiliated launching activity's task. * affiliated tasks grouped in recents task list. * * <p>this behavior not supported activities {@link * android.r.styleable#androidmanifestactivity_launchmode launchmode} values of * <code>singleinstance</code> or <code>singletask</code>. */ public static activityoptions maketasklaunchbehind() { final activityoptions opts = new activityoptions(); opts.manimationtype = anim_launch_task_behind; return opts; }
so seems android support feature, couldn't find out how use this. has done similar? how can open new activity inside of new task , let occur behind current task?
well, after search in source code, find animation type can specified options passed in startactivity...but key , value request feature seems not public since can't access them directly. but, after all, can request feature following code:
intent intent = new intent(mainactivity.this, testactivity.class); intent.addflags(intent.flag_activity_new_document | intent.flag_activity_multiple_task); bundle bundle = new bundle(); bundle.putint("android:activity.animtype", 7); startactivity(intent, bundle);
now wonder there better , more standard way of requesting feature? looks dangerous use literal string instead of constant field of class.
Comments
Post a Comment