I want my application to work like this:

1. When the user launches the application, it starts up.
2. When the user hits back, or home, the application is still running
(although not visible).
3. If the user hits "menu->quit" the application exits cleanly.
4. If the user starts the application, hits "home" and selects the
application icon *again*, I want it to bring up the existing insance
of the application with whatever activity state it had before it left.
5. I do not ever want more than one instance of my application to be
running (i.e. singleton).
6. I always want to retain activity stack/state.  when you come back
into the application, it's like you never left.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
          package="com.company.gui"
          android:versionCode="1"
          android:versionName="1.0">
    <application android:icon="@drawable/icon"
                 android:label="@string/app_name"
                 android:debuggable="true">
        <activity android:name=".Main"
                  android:launchMode="singleTask"
                  android:alwaysRetainTaskState="true"
                  android:label="@string/app_name"
                  android:screenOrientation="portrait"
                  android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".SplashScreen"
                  android:label="@string/app_name">
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET"></uses-
permission>
</manifest>

my main activity onCreate() looks like this:

        startActivityForResult( new Intent(this, SplashScreen.class),
SPLASH_REQUEST_ID );
        new Thread() {
                public void run() {
                        try {
                                        Thread.sleep(4 * 1000);

                                        // put initialization stuff here.

                                } catch (InterruptedException e) {
                                        e.printStackTrace();
                                }
                        finishActivity( SPLASH_REQUEST_ID );
                }
        }.start();

        setContentView(R.layout.main);

If I leave the application by hitting home and then selecting the icon
again, it starts with the splash screen again!

any ideas on how to best fix this?

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