title: how to save List-view position when back to previous Activity in Android
body: <p>I have a ListView with huge amount of data.But when i go to next page on ListView Item Click and come back to ListView. <strong>I want the list to be scrolled to the same point that it was previously</strong>.Can someone help to achieve this. </p>
  
  <p>I tried this code.List to be scrolled to the same point but immediately come to the first position.</p>
  
  <pre><code>private void populateList() {
          descArray.clear();
          List&lt;All_Post&gt; allDesc = dbhelper.getAllDescriptions();
          for (All_Post all_Post : allDesc)
          {
              descArray.add(all_Post);
          }
  
          if (adapter == null)
          {
              adapter = new AllPostAdapter(this, R.layout.allpostlist, descArray);
              listView.setAdapter(adapter);
          }
          else if (adapter != null) {
  
  
              adapter.notifyDataSetChanged();
              adapter = new AllPostAdapter(this, R.layout.allpostlist, descArray);
              listView.setAdapter(adapter);
              //int firstPosition = listView.getFirstVisiblePosition();
              //listView.setSelection(firstPosition);
  
              int index = listView.getFirstVisiblePosition();
              View v = listView.getChildAt(0);
              int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop());
              listView.setSelectionFromTop(index, top);
          }
      }
  </code></pre>