• Post Reply Bookmark Topic Watch Topic
  • New Topic

Restore orientation ( maintain the position of the listview inside a Fragment)  RSS feed

Ranch Hand
Posts: 457
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EDIT: Solved. in
onSaveInstanceState i call listView.getFirstVisiblePosition()
from there you pass the result where you need using the usual tecniques, personally my project is complex so I put the result in other 3 points, comprehending OnCreateView
where i get the string

I have a ListView inside a Fragment, if I change the orientation, I would like that saveInstance Bundle will save my position. I have

and does not matter if I put in OnCreateView or in onActivityCreated the following code

the up position of the list is not restored at all. I can easily see from the debug in Bundle that the debug recognize in the Bundle the position,

AbsListView.SavedState{3d7562e0 selectedId=-9223372036854775808 firstId=25 viewTop=-38 position=5 height=717 filter=null checkState=null}

I even tried to extract from the Bundle this position in an isolated way instead of all the values, but without success.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!