android回到第一个屏幕 [英] android go back to first screen
问题描述
我有一个带有链接(由 linkify 制作)的 android 应用程序,这些链接指向我的应用程序的其他屏幕.我想知道关闭所有子"活动并返回最初启动的第一个活动的最佳方法是什么.
I have an android app with links (made by linkify) that lead into other screens of my app. I'm wondering what's the best approach to close all of the 'child' activities and go back to the first activity that was originally launched.
换句话说是这样的:
HomeScreenActivity => Screen1(通过 Linkify-link)=> Screen2 => Screen3 => 点击主页 =>(关闭屏幕 1、2 和 3)=> HomeScreenActivity
HomeScreenActivity => Screen1 (via Linkify-link) => Screen2 => Screen3 => click home => (close screens 1, 2 & 3) => HomeScreenActivity
推荐答案
您应该能够通过使用 FLAG_ACTIVITY_CLEAR_TOP 标志.
You should be able to accomplish this by creating an intent for your HomeScreenActivity with the FLAG_ACTIVITY_CLEAR_TOP flag.
这篇关于android回到第一个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!