[android-developers] Re: Unit Testing - Activity shutdown

2010-11-30 Thread A. Elk
I'm not sure that the discouragement of "exit" is in any written guidelines. I just know that exiting applications is both discouraged and unnecessary. I did not say that *finish()* is disallowed. You certainly can use it to close an Activity that is done with its work. It's not normally used for

[android-developers] Re: Unit Testing - Activity shutdown

2010-11-30 Thread Ian
Got this all working and reliably. I still use a state variable to tell me where I am in the state machine - not ideal. My reliability problems seem to have been down to using SharedPreferences to hold state between tests. Thanks for the responses. Ian Hunter On Nov 29, 8:10 pm, Ian wrote: >

[android-developers] Re: Unit Testing - Activity shutdown

2010-11-29 Thread Ian
Thanks for your response - I think this could be enlightening However, a few questions... On Nov 29, 7:30 pm, "A. Elk" wrote: > Can I get clarification here? Does your application call finish() at > some point? If so, at what point? > > The Android design guidelines strongly discourage the use o

[android-developers] Re: Unit Testing - Activity shutdown

2010-11-29 Thread A. Elk
Can I get clarification here? Does your application call finish() at some point? If so, at what point? The Android design guidelines strongly discourage the use of an "exit" button. You should see that most apps don't have one. The way to "exit" an application is to switch to another one (includin

[android-developers] Re: Unit Testing - Activity shutdown

2010-11-29 Thread Ian
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 int

[android-developers] Re: Unit Testing - Activity shutdown

2010-11-29 Thread Ian
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 proces