WOW it took me _forever_ to figure out exactlly what you meant...
Here is the manifest section needed for anyone needing help here.
<application android:icon="@drawable/icon" android:label="@string/
app_name">
<activity android:taskAffinity="org.appname.act1"
android:label="@string/act1_label
android:name=".act1"
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:taskAffinity="org.appname.act2"
android:name=".act2"
android:label="@string/act2_label"
android:theme="@android:style/Theme.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
On Feb 5, 2:31 pm, tauntz <[email protected]> wrote:
> Thanks Dianne.
>
> Just for the record (if someone else needs the solution and finds this
> thread):
> If you want to have two different applications in one .apk then you
> need to have both launcher Activities with the LAUNCHER category as
> Romain said.
> You also need to add different task affinities to these activities.
> Otherwise you might bump into the problems that I described (and as
> far as I understand, this is designed to behave like that :) )
>
> One more note - don't
> believehttp://code.google.com/android/intro/appmodel.htmlentirely - you
> can't have task affinities in the form "append your .apk's package
> name with a colon separated string" - colons are not supported
> characters there. Also replace the words "you will probably want to"
> with "you have to" in your head when reading this :)
>
> Tauno
>
> On Thu, Feb 5, 2009 at 8:02 PM, Dianne Hackborn <[email protected]> wrote:
> > If you want two fully distinct apps, you need to give them different task
> > affinities. Please read this before you go farther:
>
> >http://code.google.com/android/intro/appmodel.html
>
> > On Thu, Feb 5, 2009 at 7:56 AM, tauntz <[email protected]> wrote:
>
> >> On Tue, Feb 3, 2009 at 10:37 AM, Romain Guy <[email protected]> wrote:
> >> > Yes :) Just put two activities in your manifest, both with the
> >> > LAUNCHER category.
>
> >> I tried that but it seems I'm still doing something wrong (see code at
> >> the end of the message). The results I get are:
> >> * Two launcher entries (Ativity A and Activity B) are placed in the
> >> activity list in Home
> >> * Clicking first on Activity A will start Activity A.
> >> * Going back and clicking on Activity B will start Activity A again.
> >> * If I click on Activity B the first time after install, B is started
> >> and going back -> clicking on A, starts B again
>
> >> Any hints on what I'm doing wrong?
>
> >> LogCat:
> >> INFO/ActivityManager(55): Starting activity: Intent {
> >> action=android.intent.action.MAIN
> >> categories={android.intent.category.LAUNCHER} flags=0x10200000
> >> comp={test.activity/test.activity.ActivityA} }
> >> INFO/ActivityManager(55): Start proc test.activity for activity
> >> test.activity/.ActivityA: pid=13716 uid=10036 gids={}
> >> INFO/jdwp(13716): received file descriptor 10 from ADB
> >> INFO/ActivityManager(55): Displayed activity test.activity/.ActivityA: 872
> >> ms
> >> INFO/ActivityManager(55): Starting activity: Intent {
> >> action=android.intent.action.MAIN
> >> categories={android.intent.category.HOME} flags=0x10200000
> >> comp={com.android.launcher/com.android.launcher.Launcher} }
> >> INFO/ActivityManager(55): Starting activity: Intent {
> >> action=android.intent.action.MAIN
> >> categories={android.intent.category.LAUNCHER} flags=0x10200000
> >> comp={test.activity/test.activity.ActivityB} }
>
> >> Code:
> >> <?xml version="1.0" encoding="utf-8"?>
> >> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> >> package="test.activity"
> >> android:versionCode="1"
> >> android:versionName="1.0.0">
> >> <application>
>
> >> <activity android:name=".ActivityA" android:label="Activity A">
> >> <intent-filter>
> >> <action android:name="android.intent.action.MAIN" />
> >> <category android:name="android.intent.category.LAUNCHER"
> >> />
> >> </intent-filter>
> >> </activity>
>
> >> <activity android:name=".ActivityB" android:label="Activity B">
> >> <intent-filter>
> >> <action android:name="android.intent.action.MAIN" />
> >> <category android:name="android.intent.category.LAUNCHER"
> >> />
> >> </intent-filter>
> >> </activity>
>
> >> </application>
> >> </manifest>
>
> >> public class ActivityA extends Activity {
>
> >> �...@override
> >> public void onCreate(Bundle savedInstanceState) {
> >> super.onCreate(savedInstanceState);
> >> TextView tv = new TextView(this);
> >> tv.setText("ActivityA");
> >> setContentView(tv);
> >> }
>
> >> }
>
> >> public class ActivityB extends Activity {
>
> >> �...@override
> >> public void onCreate(Bundle savedInstanceState) {
> >> super.onCreate(savedInstanceState);
> >> super.onCreate(savedInstanceState);
> >> TextView tv = new TextView(this);
> >> tv.setText("ActivityB");
> >> setContentView(tv);
> >> }
> >> }
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support. All such questions should be posted on public
> > forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---