Is it possible to have more than one run?

Is it possible to have more than one application in one apk file? or is there a way to have different launch icons for different actions within the same application? I want to separate my application from some (but related) logical parts.

+6
source share
2 answers

Yes, just mark two or more of yours <activity>asLAUNCHER inside your manifest. In addition, you need to set an attribute android:taskAffinityfor both of your Launcher-Activities actions, which determine the exact package and the action to be run.

<activity android:label="MyApp" android:name=".MyApp" android:taskAffinity="com.example.MainActivity">
        <intent-filter>
            <action android:name=".MyApp"/>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
</activity>


<activity android:label="Settings" android:name=".Settings" android:taskAffinity="com.example.SettingsActivity" >
    <intent-filter>
        <action android:name=".Settings"/>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>
+9
source

, . - . , , .

0

All Articles