【发布时间】:2014-01-24 22:29:40
【问题描述】:
我想恢复启动我的活动的 android 意图。
我的活动在 API 19 (KitKat) 中测试,除了主要意图外,还有以下意图过滤器和参数:
android:alwaysRetainTaskState="false"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize">
<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=".*\\.svg" />
<data android:host="*" />
</intent-filter>
但是,当我在 Activity 运行时打开 SVG 文件时,它不会处理新的 Intent。 我尝试了以下组合,启动了活动,
android:launchMode="singleTask"
android:launchMode="standard"
android:launchMode="singleTop"
结合以下参数,构成6种配置
android:finishOnTaskLaunch="true" or "false"
但是当我使用我的应用程序打开 SVG 时,它们都没有使 onNewIntent 函数被调用。相反,它会显示之前的状态(按预期调用 onPause 和 onResume,而改为调用 onCreate)。
我发现的唯一解决方法是使用 onPause() 方法调用 finish() 函数,以便它有效地终止应用程序。我不明白发生了什么,因为在我改变目标之前它在去年就起作用了。
每次访问调用意图所需的配置是什么?
没有答案的相关问题:
- This blog 解释说我应该使用“singleTop”,但它不适用于我的情况。
- This SO question 没有任何答案。
- This famous SO question 描述了意图的设置。但就我而言,我自己不会创建意图,android 会。
【问题讨论】:
-
你有没有找到解决办法?
-
是的,看看我的回答,谢谢你的提问。
标签: android onnewintent