How to resolve Back button issue in android device.


Last Updated:

  1. senthilmg

    senthilmg New Member This Topic's Starter

    Joined:
    Aug 26, 2010
    Messages:
    4
    Likes Received:
    0
    friend's
    I am facing a problem when i use back button in my android device or from UI, initially i have list view (List1) with content,when i click list view row it moves to next listview (List2) with AsyncTask to represent it progress upto it completion and to set on list(List2) ,and next i click this list(List2) i have to move webview,here my problem is back button is not working properly,it back to previos page but listview have empty display.
    here my code for UI click event

    back.setOnClickListener(new OnClickListener(){

    finish();

    });

    how can i fix this problem
     

    Advertisement
  2. SWhite

    SWhite Member

    Joined:
    Apr 15, 2010
    Messages:
    17
    Likes Received:
    1
    all the finish() call does is call the onStop() followed by onDestroy() for the current activity. Using this as the sole click event in your activity simply destroys the current view, revealing the previous view which, up until the click, has been stored in the activity stack. Your click event should call the onResume() of the previous activity (list2 if i read the example correctly) followed by the finish().

    I hope this helps. PM if still stuck
     

Share This Page

Loading...