"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. Database issue on device

           i am using a db file and trying to access that file thru
emulator it works perfectly fine but when i run the same app on device
i get the error of no such table when i checked the path also it gives
the right path and also the status of database open flag it returns
true not able to guess what i am i doing wrong i have changed the
permissions of database folder also for the emulator still no luck for
that reason i wanted to check the folder of device are the db files
present ... Thnx in advance...


2. Problem with getChildCount method???

I have problem...i m using a base adapter for binding a data from
array to listview....the listview has a checkbox with it...i wanted to
create a menu to select all or deselect all view inside that
list...but the getchildCount method is behaving abnormally..i m not
able to get the correct child count...can anybody help me plz......???

public boolean onOptionsItemSelected(final MenuItem item) {
            if (item == mSelectAllItem ) {

            LayoutInflater      mInflater = LayoutInflater.from(this);
            View view = (View)mInflater.inflate(R.layout.list_item,

                ListView listView = getListView();

            int listItemCount = listView.getChildCount();
            int listItemCount1 = listView.getCount();
            System.out.println("<<<<<<<<<Child Count in select
            System.out.println("<<<<<<<<< Count in select
            for( int j=0;j<listItemCount;j++ )
                CheckBox cbox=(CheckBox)((View)listView.getChildAt
                if( !cbox.isChecked() ) {
                 } else {

        return true;

3. Setting Focus by code in an array list

4. Adapting the Music app's TouchInterceptor

5. Adapting the Music app's TouchInterceptor

6. Application doesnot quit on calling finish()

7. Using the manifest file in android