Proper way to finish an activity

by DroidBy » Wed, 31 Mar 2010 16:10:30 GMT


Sponsored Links
 I think someone here can anwer me..

I have an application with 3 activities, A, B and C.
Three points here:-
1. In normal user sequence, activity A will start activity B, activity
B will then start activity C.

2. In case, user is also allowed to cancel activity B (by a button),
and it will resume back to activity A.

3. If activity B is interrupted by any application which comes into
foreground, activity B should be killed and user should start from
activity A if user navigate back to my application.

In point 2, I have called finish() if user click on the button;

In point 3, I have called finish in activity B onPause() function

End up, I get an warning saying that I have duplicate finish request
by Activity Manager as in point 2, the onPause() will be called also.

So, does anyone here no how should I do in handling for point 2 so
that I am able to resume to activity A after user cancels activity B?
Or how should I do in case to stop my activity B so that user always
start from activity A?


Any best advise here?

--



Proper way to finish an activity

by Peter Fortuin » Wed, 31 Mar 2010 16:23:58 GMT


 Hi DroidBy,

Maybe it's a good idea to read the following:
 http://developer.android.com/guide/topics/fundamentals.html #actlife
Read the part about the Activity lifecycle. That should answer your
questions.

Kind regards,

Peter


2010/3/31 DroidBy <meikeng....@gmail.com>

>


Sponsored Links


Proper way to finish an activity

by DroidBy » Thu, 01 Apr 2010 10:06:36 GMT


 Peter,

I read that before. But it still can't solve my problem in point 2.

As if I call finish during onPause(), then I will have duplicate
finish request complaint by the ActivityManager if user clicks on the
<Cancel> button which will call finish() , and then the activity will
enter into pause state and call finish() again.

:(






> >



Proper way to finish an activity

by DroidBy » Thu, 01 Apr 2010 11:51:43 GMT


 Hi Peter,

Ya, by implementing some flags, I manage to see if I should call
finish in the onPause state.
Now my problem is resolved.

Thanks.





> > >



Other Threads

1. Job Market Android

Good morning.

Currently I live in Brazil and would like to know how is the job market for
the Android platform in the U.S.. There are already many companies?

Att,
-- 
Digo Nunes Assuno
"Give Peace a Chance"

-- 

2. Sony Ericsson LiveView鈩?micro display SDK is released

Here can you find  LiveViewmicro display SDK

http://developer.sonyericsson.com/wportal/devworld/downloads/download/liveviewmicrodisplaysdk?cc=gb&lc=en

LiveViewmicro display developer tutorial

http://developer.sonyericsson.com/wportal/devworld/downloads/download/liveviewmicrodisplaydevelopertutorial?cc=gb&lc=en

-- 

3. android.intent.action.SEARCH blocks android.intent.category.LAUNCHER

4. Monkey Documentation

5. code error

6. How to capture KeyEvents when the phone is asleep ?

7. How to disable Gallery center-locked