Hi,

What is the proper way to launch an application on Android?
I tried all possible launchMode values, but all of them fail with
several different problems (see below).

This question was already asked many times, for example
http://groups.google.com/group/android-developers/browse_thread/thread/a7c07c8808c50547/6bf6b5b8bfb5d883
http://groups.google.com/group/android-developers/browse_thread/thread/59be582e9a75e9eb/31cf3bc4cd992bf5
http://groups.google.com/group/android-developers/browse_thread/thread/62d9f489d22d7c5f/69983dc3a23c100a
http://stackoverflow.com/questions/2417468/android-bug-in-launchmodesingletask-activity-stack-not-preserved
http://groups.google.com/group/android-developers/browse_thread/thread/76fa8600833f5348/59210de050c9bd20

But I still cannot find any answer.

Unlike other posts mentioned above, I performed all my tests with
samples\android-8\NotePad application.
The only line, which I changed, was launchMode in <activity
android:name="NotesList">
I tested on Android emulator 2.1 and 2.2 and also on DroidX 2.2.
Results are the same.

Here are the steps to reproduce the bugs:

android:launchMode="standard" - this is the default
1. When installing NotePad application tap "Open".
2. Create a new note, begin editing, then press Home button.
3. Launch NotePad from the home screen - the editor disappeared, only
the list displayed. This is bug #1.
4. Tap on the note and continue editing.
5. Note: if user continues repeating Home/Launch cycle, then there may
be multiple activities created
   and the application will run out of memory.
6. Press Back. Return to the list.
7. Press Back. Again see the editor! This is bug #2 (actually it is
the same bug, but customers are not aware of it and report it
separately).
8. Press Back. Return to the list.
9. Press Back. Return to the home screen.
Now the application is closed.
1. Launch NotePad from the home screen, see the list, tap on the note,
begin editing, then press Home.
2. Launch NotePad from the home screen, see the editor - this is
correct behavior.
3. Press Back. Return to the list.
4. Press Back. Return to the home screen - this is correct behavior.

Now set launchMode="singleTop"
The behavior is the same as for "standard"

Now set android:launchMode="singleTask"
Now the behavior is a bit different:
1. When installing NotePad application tap "Open".
2. Create a new note, begin editing, then press Home button.
3. Launch NotePad from the home screen - the editor disappeared, only
the list displayed. This is bug #1.
4. Tap on the note and continue editing.
5. Press Back. Return to the list.
6. Press Back. Return to the home screen. OK Bug #2 is fixed.
Now the application is closed.
1. Launch NotePad from the home screen, see the list, tap on the note,
begin editing, then press Home.
2. Launch NotePad from the home screen - the editor disappeared, only
list displayed. This is bug #3.
3. Press Back. Return to the list.
4. Press Back. Return to the home screen - this is correct behavior.

Now set android:launchMode="singleInstance"
The behavior is the same as for "singleTask"

So, every possible launchMode cause a buggy behavior.
At least this is the opinion of my customers, who are accustomed to a
more consistent behavior of applications on other mobile platforms,
which always display the last view of the application and do not
launch a new instance, like launchMode="standard" does.
launchMode="standard" appears to be the worst because it is not only
inconsistent, but also causes the application to run out of memory.

Launching an application is the very basic operation, which each
application must do properly.
I cannot believe that such fundamental operation is broken and no work
around is available.
If there is a work around, it must be printed in big red letters all
over the SDK documentation and the samples should be fixed as well.
But I still cannot find it.

Please, tell me how you solve this in your apps?

Thank you
John


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