• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic