Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.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
Android 两个应用程序之间的冲突_Android - Fatal编程技术网

Android 两个应用程序之间的冲突

Android 两个应用程序之间的冲突,android,Android,我制作了我的第一个应用程序,它仍然在模拟器上。所以在测试第二个时,我运行了它。启动屏幕完成了它的工作,然后应用程序退出,并出现一条消息说,选择我正在测试的第一个应用程序或第二个应用程序来完成操作,而不是进入我正在测试的应用程序的主要活动。那么,我如何避免这种情况,或者让应用程序不给用户这个选项呢 编辑: 应用程序1: 舱单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schema

我制作了我的第一个应用程序,它仍然在模拟器上。所以在测试第二个时,我运行了它。启动屏幕完成了它的工作,然后应用程序退出,并出现一条消息说,选择我正在测试的第一个应用程序或第二个应用程序来完成操作,而不是进入我正在测试的应用程序的主要活动。那么,我如何避免这种情况,或者让应用程序不给用户这个选项呢

编辑:

应用程序1:

舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hellhog.tfreq"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >      
    <activity 
    android:name="com.google.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >        
    </activity>

    <activity
        android:name="com.hellhog.tfreq.Splash"
        android:label="@string/app_name"
        android:screenOrientation="landscape" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.hellhog.tfreq.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAINACTIVITY" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hellhogone.multitools"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.hellhogone.multitools.Splash"
        android:label="@string/app_name"
        android:screenOrientation="landscape" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
     <activity
        android:name="com.hellhogone.multitools.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAINACTIVITY" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.hellhogone.multitools.FlashLight"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.FLASHLIGHT" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.hellhogone.multitools.Mirror"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MIRROR" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
应用程序2: 舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hellhogone.multitools"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.hellhogone.multitools.Splash"
        android:label="@string/app_name"
        android:screenOrientation="landscape" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
     <activity
        android:name="com.hellhogone.multitools.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAINACTIVITY" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.hellhogone.multitools.FlashLight"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.FLASHLIGHT" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.hellhogone.multitools.Mirror"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MIRROR" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>

这是因为您的两个应用程序不同(意味着具有不同的包名),而在两个应用程序的Androidmanifest文件中,您为MainActivity指定了相同的意图过滤器。请考虑在App.

中添加不同的意图过滤器。
    <activity android:name="MainActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.example.yourcustom.intent"/>
        </intent-filter>
    </activity>

并为您提供可以处理该意图的所有应用程序的选项,这就是为什么您将获得应用程序选择器对话框。

更改两个活动的包…您是否可以发布代码、如何启动两个应用程序的主活动和清单文件可能是您在两个应用程序的活动的意图筛选器中都指定了某些操作。发布两个清单文件,以便我们了解一些信息
    <activity android:name="MainActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.example.yourcustom.intent"/>
        </intent-filter>
    </activity>