"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. Finding direction using compass

Hi all,

I need to know if there is an interface to access the direction in
which the phone is pointing.


2. 2010 : Android Army is coming..choose ur soldier!!

Ehmm...mine is...

Milestone!! Yeay...what about you?

sent from Milestone...

3. App crashes on Droid, works fine on G1

4. Flowing View Group

5. applying style to textview

6. getting Current Application Context

7. activity animation