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);
    }
}

--~--~---------~--~----~------------~-------~--~----~
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