Save position of scroll on webview after page closed - android

I am having a webview inside my application with multiple links inside. On a one page I have a list of items, but when I am going to an another page and going back to this page, my page can't restore the scroll position. How to save scroll position in this case?

Related

Saving state for each page of a view pager properly

I have a view pager and each page selects user input. It is based on views and not fragment and is inside an Activity.
I want at the final step to collect all the user selections from all the pages.
How can I keep the selections and be able to properly update them if the user goes back/forth the viewpager?

Swipeable screen with content inside webView

I have a screen with recyclerView and articles list inside it. After clicking on item - i open new activity with content inside WebView (each article has own url which is displayed). I need to improve this functionality and add ability to switch between articles inside my activity with WebView by swipe movement (left - right).
That is my question: which way should i choose, make it with ViewPager or intercept swipe moves manually and refresh only content for WebView. Which way would be better for performance and more friendly user? Maybe some of you already have this experience?

Viewpager doesn't update current page

I have a Gridview in all page inside ViewPager. When I try to load the images in gridview in all page, it doesn't updated the current page because problably ViewPager caches the recent views. So when I navigate to further pages, I can see the changes. How can I make the current page show the changes. Thanks...

Android ViewPager: How to scrolling event beyond the end of the pager

I have a ViewPager which displays a bunch of pages, what I'd like to do is to detect when the user is at the last page and still attempting to scroll to the next page (of course this will not work). At that time the app should begin loading new pages and display them after loaded.
Is there any built in event that handles this event? Or how can I do it manually?

Dynamically ViewPager flow of pages

I've used ViewPager to let the user flip left and right to navigate among pages of a given activity.
Is it possible to programatically control the flow of pages of the ViewPager?
For exemple:
If the user didn't fill a given EditText on the current page, I don't want him to be able to navigate to the next one.
Another case: If the user is currently on page 1 and if hi filled a given EditText with a specific value and the user flip right to left, I want him to go straight to the 5th page instead of the 2nd one.
By "flipping" you mean dragging with a finger or just using the ViewPager for animation?
If it's the former, you'll have to dynamically edit the children of the ViewPager to get the effect you want. You can override onInterceptTouchEvent() to block touch events until a page is completed.
However, I recommend disabling finger-dragging in the ViewPager (perhaps using onInterceptTouchEvent()) and then using setCurrentItem(4, true) to show the animation and navigate to a specific page. The logic you need can be implemented using buttons which will call setCurrentItem(4, true). For example, you can have a "Next->" button that is grayed out unless the form is completely completed. That will be more intuitive then the first option anyway.
Edit: 4 is just whatever child index you want to switch to.

Categories

Resources