Hi Dianne,

To follow up on this, the package installer seems to launch apps in a
similar way Eclipse does, so, the same thing happens here as launching
from Eclipse:


// From eclipse:
Starting activity: Intent { flags=0x10000000 comp={com.test.testapp/
com.test.testapp.ActivityMain} }

// From package installer (installing APK from the web browser):
Starting activity: Intent { action=android.intent.action.MAIN
flags=0x10000000 comp={com.test.testapp/
com.test.testapp.ActivityMain} }

In both cases, I see:

 1) App gets started (running entry-point Activity A)
 2) App can launch a second activity (Activity B).
 3) Hit the home screen key.
 4) Return to app via app tray icon (expect to come back to Activity
B).
 5) Instead of resuming already running app, seems like a new one is
started (now showing Activity A)
 6) Hit the back key, oddly enough return to ActivityB - back key
again goes again to original Activity A).

There's got to be a way to stop this from happening? Users get
confused when launching from the package explorer. This isn't just my
app, this is happening with other 3rd party apps I've been trying out
to verify,

Thanks



On Dec 3, 12:04 am, Mark Wyszomierski <mar...@gmail.com> wrote:
> Oh I definitely wasn't precise about the launch method, sorry about
> that! I definitely didn't think the launch method could have anything
> to do with it, I was trying all sorts of launch modes, thinking maybe
> that's what the problem was,
>
> Thanks
>
> On Dec 2, 11:57 pm, Dianne Hackborn <hack...@android.com> wrote:
>
>
>
> > I would have mentioned this issue, but you seemed to be very clear that you
> > were launching from an icon in home both times. :}
>
> > Anyway, I am pretty sure this has been fixed in the tool, though I don't
> > know if that fix is in the current release.
>
> > On Wed, Dec 2, 2009 at 8:02 PM, Mark Wyszomierski <mar...@gmail.com> wrote:
> > > Actually, I'm probably experiencing this bug, my test app behaves
> > > exactly as described:
>
> > >http://code.google.com/p/android/issues/detail?id=2373#makechanges
>
> > > does anyone else see this behavior?
>
> > > Thanks
>
> > > On Dec 2, 8:16 pm, Mark Wyszomierski <mar...@gmail.com> wrote:
> > > > I may just be misinterpreting what I'm seeing through DDMS actually.
> > > > When I run my app, I have three activities, A, B, C. In the DDMS app
> > > > list, I see my app listed like:
>
> > > >   ....
> > > >   com.test.myapp
> > > >   ....
>
> > > > if I select it, and hit the Stop button, it will be killed, but then
> > > > replaced by a new instance of the application. Different results
> > > > depending on which activity I'm looking at. If I Stop when Activity A
> > > > is showing, A just keeps being restarted. If I kill when B is showing,
> > > > A is shown again. If I  kill when C is running, B shows itself.
>
> > > > So I'm guessing this is just the OS trying to restart from the last-
> > > > paused activity - and if on Activity A, there is no previous activity,
> > > > so it just gets restarted itself. Is this correct? Sorry for the
> > > > confusion,
>
> > > > Thanks
>
> > > > On Dec 2, 10:27 am, Mark Wyszomierski <mar...@gmail.com> wrote:
>
> > > > > I don't know if it's monkey or not - it looks like it's just this
> > > > > install (I'm sure it's the most recent SDK) - I can reproduce this odd
> > > > > behavior on there. On my other machine, and my test phone, looks like
> > > > > the default behavior is correct (with the same test apps and same SDK
> > > > > updates). Thanks for your help.
>
> > > > > On Dec 1, 8:38 pm, Dianne Hackborn <hack...@android.com> wrote:
>
> > > > > > Monkey may be doing odd things.  Tasks are matched by intent, so if
> > > you
> > > > > > build different intents you will be launching different tasks.
>
> > > > > > On Tue, Dec 1, 2009 at 5:33 PM, Mark Wyszomierski <mar...@gmail.com>
> > > wrote:
> > > > > > > Ok so the sample app code above should be producing the default
> > > > > > > behavior though, right? This is happening on a mac running 1.5. I
> > > did
> > > > > > > a fresh install of the SDK and the test app on a windows machine
> > > here,
> > > > > > > and it works as you described on that machine (always resumes
> > > instance
> > > > > > > if running in background instead of creating new instances).
>
> > > > > > > I'll also see multiple instances when running the monkey test app
> > > (on
> > > > > > > the problematic machine). In the DDMS process list, there will be
> > > one
> > > > > > > listing for the test app. I select it, hit the stop button. The
> > > list
> > > > > > > then shows another instance in its place (has a diff online value
> > > > > > > etc). It seems like the monkey test app has launched dozens of
> > > > > > > instances of the test app.
>
> > > > > > > On the windows machine, this does not happen, there is only one
> > > > > > > instance of my app after the monkey test app runs. When I select
> > > it,
> > > > > > > and hit stop - it's cleared from the list, and that's the only
> > > > > > > instance.
>
> > > > > > > I'm not sure what's going on, but if the sample app above is
> > > correct
> > > > > > > and functions in the default manner you described, I'll go with
> > > that
> > > > > > > and then do some further testing on some devices,
>
> > > > > > > Thanks
>
> > > > > > > On Dec 1, 7:37 pm, Dianne Hackborn <hack...@android.com> wrote:
> > > > > > > > I don't know what you are doing.  If you try one of the sample
> > > apps like
> > > > > > > > ApiDemos you will see this works fine.
>
> > > > > > > > On Tue, Dec 1, 2009 at 4:18 PM, Mark Wyszomierski <
> > > mar...@gmail.com>
> > > > > > > wrote:
> > > > > > > > > Hi Dianne,
>
> > > > > > > > > The default behavior is what I'm going for - but I'm just not
> > > seeing
> > > > > > > > > that - I made this small test app - it just has two 
> > > > > > > > > activities.
> > > I
> > > > > > > > > start the app from the app tray. Then have the first activity
> > > launch
> > > > > > > > > the second activity. I hit the home button to put the app in
> > > the
> > > > > > > > > background. When I hit the app icon from the app tray again,
> > > instead
> > > > > > > > > of seeing the app resume from its paused state (the 2nd
> > > activity
> > > > > > > > > should be showing?), the first activity is shown again:
>
> > > > > > > > > package com.test.teststates;
>
> > > > > > > > > import android.app.Activity;
> > > > > > > > > import android.content.Intent;
> > > > > > > > > import android.os.Bundle;
> > > > > > > > > import android.view.View;
> > > > > > > > > import android.view.View.OnClickListener;
> > > > > > > > > import android.widget.Button;
>
> > > > > > > > > public class ActivityMain extends Activity {
> > > > > > > > >   �...@override
> > > > > > > > >    public void onCreate(Bundle savedInstanceState) {
> > > > > > > > >        super.onCreate(savedInstanceState);
> > > > > > > > >        setContentView(R.layout.main);
>
> > > > > > > > >        Button btn = (Button)findViewById
> > > > > > > > > (R.id.activity_main_btnLaunchActivity);
> > > > > > > > >        btn.setOnClickListener(new OnClickListener() {
> > > > > > > > >            public void onClick(View v) {
> > > > > > > > >                // launch the second activity from button
> > >  click.
> > > > > > > > >                Intent intent = new Intent();
> > > > > > > > >                intent.setClass(ActivityMain.this,
> > > > > > > > > ActivityChild.class);
> > > > > > > > >                startActivity(intent);
> > > > > > > > >            }
> > > > > > > > >        });
> > > > > > > > >    }
> > > > > > > > > }
>
> > > > > > > > > package com.test.teststates;
>
> > > > > > > > > import android.app.Activity;
> > > > > > > > > import android.os.Bundle;
>
> > > > > > > > > public class ActivityChild extends Activity {
> > > > > > > > >   �...@override
> > > > > > > > >    public void onCreate(Bundle savedInstanceState) {
> > > > > > > > >        super.onCreate(savedInstanceState);
> > > > > > > > >        setContentView(R.layout.activity_child);
> > > > > > > > >    }
> > > > > > > > > }
>
> > > > > > > > > <application android:icon="@drawable/icon"
> > > android:label="@string/
> > > > > > > > > app_name">
>
> > > > > > > > >     <activity android:name=".ActivityMain"
> > > > > > > > >               android:label="@string/app_name">
> > > > > > > > >         <intent-filter>
> > > > > > > > >            <action android:name="android.intent.action.MAIN" 
> > > > > > > > > />
> > > > > > > > >            <category
> > > android:name="android.intent.category.LAUNCHER" /
>
> > > > > > > > >        </intent-filter>
> > > > > > > > >    </activity>
>
> > > > > > > > >    <activity android:name=".ActivityChild"
> > > > > > > > >              android:label="@string/app_name">
> > > > > > > > >        <intent-filter>
> > > > > > > > >            <action android:name="android.intent.action.VIEW" 
> > > > > > > > > />
> > > > > > > > >            <category
> > > android:name="android.intent.category.DEFAULT" /
>
> > > > > > > > >        </intent-filter>
> > > > > > > > >    </activity>
>
> > > > > > > > > </application>
>
> > > > > > > > > <uses-sdk android:minSdkVersion="3" />
>
> > > > > > > > > On Dec 1, 5:09 pm, Dianne Hackborn <hack...@android.com>
> > > wrote:
> > > > > > > > > > On Tue, Dec 1, 2009 at 1:46 PM, Mark Wyszomierski <
> > > mar...@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > > > I guess I'm not understanding the default process creation
> > > method.
>
> > > > > > > > > > Fwiw, what we are talking about has absolutely nothing to do
> > > with
> > > > > > > > > processes.
> > > > > > > > > >  Please make sure you read this starting at "Activities and
> > > Tasks":
> > > > > > > > >http://dirkbd:9092/guide/topics/fundamentals.html
>
> > > > > > > > > > Note that the interaction it describes as the normal 
> > > > > > > > > > behavior
> > > for
> > > > > > > tasks
> > > > > > > > > is
> > > > > > > > > > what you seem to be asking for.
>
> > > > > > > > > > Using a new project, with two activities, A and B (both have
> > > no
> > > > > > > custom
>
> > > > > > > > > > > flags set in the manifest, and Activity A is set as MAIN
> > > and
> > > > > > > > > > > LAUNCHER):
>
> > > > > > > > > > > 1) Launch the app from the app drawer
> > > > > > > > > > > 2) Have activity A start activity B.
> > > > > > > > > > > 3) Hit the home button.
> > > > > > > > > > > 4) Go to the app drawer again, try launching the app 
> > > > > > > > > > > again.
> > > > > > > > > > > 5) Looks like a brand new process instance of the app is
> > > created,
> > > > > > > > > > > instead of returning to the original process instance
> > > that's
> > > > > > > already
> > > > > > > > > > > in the background. As a user, I'd (personally) rather just
> > > return
> > > > > > > to
> > > > > > > > > > > the instance already running in the background, rather 
> > > > > > > > > > > than
> > > create
> > > > > > > a
> > > > > > > > > > > new instance.
>
> > > > > > > > > > The normal behavior, if you don't do anything, is that in
> > > step 4 you
> > > > > > > will
> > > > > > > > > > bring the current stack of the task from step 1 brought to
> > > the
> > > > > > > > > foreground,
> > > > > > > > > > in its current state.  This is why most of the built-in apps
> > > behave
> > > > > > > this...
>
> read more »

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