Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
API 19 Android中的OnNewIntent_Android_Onnewintent - Fatal编程技术网

API 19 Android中的OnNewIntent

API 19 Android中的OnNewIntent,android,onnewintent,Android,Onnewintent,我想恢复我的活动启动时的android意图 我的活动在API 19(KitKat)中进行了测试,除主要目的外,还有以下目的过滤器和参数: android:alwaysRetainTaskState="false" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:screenOrientation="landscape" android:config

我想恢复我的活动启动时的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>
与下面的参数结合起来,这就形成了6种配置

android:finishOnTaskLaunch="true" or "false"
但是当我用我的应用程序打开SVG时,没有一个函数可以调用
onNewIntent
函数。相反,它显示以前的状态(按预期调用onPause和onResume,而调用onCreate)

我找到的唯一解决方法是使用
onPause()
方法来校准
finish()
函数,以便它有效地终止应用程序。我不明白发生了什么,因为在我改变目标之前,它在去年起作用

每次访问呼叫意图所需的配置是什么?

没有我的答案的相关问题:

  • 说明我应该使用“singleTop”,但它在我的案例中不起作用
  • 没有任何答案
  • 描述意图的设置。但在我的情况下,我并不是自己创造意图的,安卓是这样做的

目前,我的程序运行良好,可以根据需要加载SVG。关于我的配置的一些要点(可能有帮助)

  • 我的目标是安卓API 15。我放弃了19岁
  • 我在
    AndroidManifest.xml
  • 我没有在
    onPause()
    方法中调用
    finish()
  • 从不调用OnNewIntent,但会调用解析新意图的
    onCreate
    方法
  • 活动清单的内容如下所示:

    <activity
      android:name="com.example.mypackage"
      android:launchMode="singleTop"
      android:finishOnTaskLaunch="true"
      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>
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    
    
    

您找到解决方案了吗?是的,请参阅我的答案,谢谢您的提问。
<activity
  android:name="com.example.mypackage"
  android:launchMode="singleTop"
  android:finishOnTaskLaunch="true"
  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>
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>