"back button" function

by dai » Sat, 13 Sep 2008 13:16:56 GMT

Sponsored Links
 ciao, does someone know what/how android implements the back button?
If I add back button myself, Do I have to do something(use stack to
remember activity) myself?

Thank you so much

"back button" function

by Jeff Hamilton » Sat, 13 Sep 2008 13:25:58 GMT

 The Activity class will call finish() on itself if you do not
explicitly handle KEYCODE_BACK in your Activity's onKeyDown()
function. In general the system maintains a stack of activities for
you, pushing a new one when you call startActivity() and poping one
when the user hits back or you call finish() on an activity.

You can create a single activity that manages its own internal stack
of states, but it's much easier to create a new subclass of Activity
for each state you want and let the system handle that for you.



Sponsored Links

Other Threads

1. Geocoder backend service

I was reading the documentation regarding the Geocoder class and the
description says:

"The Geocoder class requires a backend service that is not included in
the core android framework."

I assume this means that the proprietary Google Maps API's provides
this backend service which routes through the Google Maps service.  I
searched around trying to find information on constructing my own
Geocoder backend service but have come up nil.  Is there any way to
produce a custom backend for the Geocoder class?

If it helps formulate a better response I'm trying to determine
locations based on the GPS coordinates to produce areas such as
streets, cities, parks, shopping centers, etc.  If something like this
already exists then I'd be more than happy to use it, but from what
I've seen searching around no such service exists for an Android

-Ryan Loebs

2. Activity throws an exception after the 1st run

Hi all,
I'm trying to run an activity that raise a camera surface, takes a
picture and then gone until the next interval.
On the first cycle it works well, but on the second cycle it raise an
Here is my code (PicTakerActivity is raised on every cycle):
Here is the log from the start of the service (MyService):


3. Navigate up activity stack

4. Using a different layout depending on parent dimensions

5. Moved Android project to Eclipse 1.5 and new machine and project is missing Android jar

6. can i create "FOLDER" for some message ....

7. Apps running cuncurrently