OK. Just run up the same app, press exit button and I get a call to
onStop(), then onDestroy(). That, I assume is what happens on the
finish() method. Notice no call to onPause() :-\

So, it looks like the test harness has a different behaviour.

A temporary, poor solution has been to create an interval variable
which gets set on state transitions (onPause(), onCreate() etc.), and
then query that variable in my test harness. Then I use
'assertTrue(state != RUNNING)'.

Not good, but I can move on for now.

Any better solutions, or insights appreciated.

Thanks
Ian Hunter

On Nov 29, 8:20 am, Ian <ian.fawcett.hun...@gmail.com> wrote:
> Thanks for the response.
>
> In my test harness, I do 'button.performClick()', which itself calls
> activity.finish().
>
> According to docs...
>
> "If an activity is paused or stopped, the system can drop it from
> memory either by asking it to finish (calling its finish() method), or
> simply killing its process."
>
> So I would expect onDestroy().
>
> I'm going to trace through (without the test harness) and see what
> actually happens.
>
> There still remains the question - how do I know onPause() was called?
> Ideally I need a callback, or a way of querying the activity for its
> state.
>
> Any help appreciated
>
> Ian Hunter
>
> On Nov 28, 9:41 pm, Frank Weiss <fewe...@gmail.com> wrote:
>
> > Chances are what you mean by "activity exits" is not in line with the
> > Android activity lifecycle. Why do you think that the onPause() callback is
> > not sufficient in this case?
>
>

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