views:

48

answers:

1

In Android, how to implement the following effect?

Install just one application, but in the launcher, there are two entries, and entering each will go to different ui.

Just like google map, you can see only one application, but there are map and navigation entries.

Thanks.

+4  A: 

You need to add category as android.intent.category.LAUNCHER for both of the activities in AndroidManifest.xml

Example:

 <application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".MyActivity1" android:label="@string/app_name">
        <intent-filter>
             ....
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MyActivity2" android:label="@string/app_name">
        <intent-filter>
             ....
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


 </application>
Ankit Jain
That works! thanks.But one more question, seems your way only share one icon, how to make those two entries have different icons ?Thanks again.
frankyyan
@frankyyan you can set icons directly to activity element.
Konstantin Burov
Yes,that is right. Thanks. Problem solved. :)
frankyyan