Android活动堆栈替换活动和擦除顶部

时间:2013-05-26 14:18:41

标签: android android-intent android-activity stack

我正在努力让这个工作,但它并不容易。 我会尽力澄清这一点,这对其他人来说可能是个好问题。

我现在有这个活动堆栈:

A - > B - > C - > d

然后我使用蓝牙接收文件,我使用顶部菜单栏接受文件,但记住我的应用程序整个堆栈仍在运行.. 然后在顶部菜单栏上,我打开我收到的文件,我希望它创建一个活动E,但有其他信息和新堆栈,所以将是:

A - > B - > C - > D - > ë

单击该文件,使用AndroidManifest.xml中的这部分代码打开活动A:

         <activity
            android:name="A"

            android:label="@string/title_activity_main_page"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="file" />
                <data android:host="*" />
                <data android:pathPattern=".*\\.sso" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.sso" />
                <data android:host="*" />
            </intent-filter>
        </activity>

在这种情况下,当通过单击文件打开活动A时,我创建了相互调用的活动。

现在这就是堆栈在最后的构建方式:

A - &gt; B - &gt; C - &gt; D - &gt; A - &gt; B - &gt; C - &gt; D - &gt; ë

我想创建:

A - &gt; B - &gt; C - &gt; D - &gt; ë

我不知道使用哪个标签,我试图阅读有关不同标志的文档,但没有找到答案。 非常感谢!

0 个答案:

没有答案