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 <tau...@gmail.com> wrote:

>
> On Tue, Feb 3, 2009 at 10:37 AM, Romain Guy <romain...@google.com> 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
hack...@android.com

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to