I populate the list-view from Sq-lite db.
Now my problem is that when i click on list-view item for going to next page and after that come back to list-view , I want the list to be scrolled to the same point that it was previously.Any idea how to do this.
This is my list-view
method in
onCreate()
private void populateList() {
descArray.clear();
List<All_Post> allDesc = dbhelper.getAllDescriptions();
for (All_Post all_Post : allDesc)
{
String strInspectorname = all_Post.getStringInspectorname();
Log.e("strInspectorname "," = " + strInspectorname);
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);
}
}
I tried this link Maintain/Save/Restore scroll position when returning to a ListView , listView goes alwyas last position .