I have a very long text in the Scroll view . When user press back button or quit the program, i want the Scroll view save its position and then when the activity is recreated, user can continue where they was left. How can i do that?
Asked
Active
Viewed 4,313 times
1
-
Related: [Keep position of ScrollView after back to prev Fragment?](https://stackoverflow.com/q/26070595/559745) – Floern Jul 15 '17 at 16:57
1 Answers
3
getScrollY() describes what you need. ScrollView inherits that and returns scroll position. To restore the position later, you need to call either scrrollTo(int, int) or smoothScrollTo(int, int). To deal with back button, you need to override onBackPressed().

Sergey M
- 521
- 4
- 17