This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Ranch Hand
Posts: 448
7
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.
 
Create symphonies in seed and soil. For this tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!