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. Self-Updating Package?

I'm looking for ideas on how to have a package that is not distributed
through the Android Market (it's in closed Beta) upgrade itself.

I had hoped to download the .apk file from my web server and then use
PackageManager.installPackage(), but that requires the
INSTALL_PACKAGES permission, which is apparently not available to
packages not installed in /system/app.

Best idea I have now is to launch an Intent to download the .apk (via
web browser), but that would require the user to then manually install
the package, which is unkind.

Other ideas?

-Timo

--~--~---------~--~----~------------~-------~--~----~

2. My Log messages fails to appear on Logcat View

I faced the Same Problem.This might be problem with DDMS.

I found a solution, If you debug your application once then log cat will
again start displaying Logs.

Thanks.

Regards
~Ankit Somani



2009/2/26 gganesh <ganesh....@gmail.com>


--~--~---------~--~----~------------~-------~--~----~

3. OpenCore bug: nOffset in OMX Buffer header

4. Touch event types supported in android v/s windows mobile

5. How can enable settings programmatically?

6. Save the background image

7. Loading fonts from memory?