how to disable webview for a while in android
What I get from your description is that if user swipe from Page 1 to Page 2 and the page is loading in the mean time if user swipe 3 times then it will load Page 2,3,4,5 and you want disable swipe at unless Page 2 has been loaded. If I am correct then below is my solution
In onfling()
method check for boolean
that whether the page is completely loaded or not if not then return without further processing and I suppose your code for downloading the code will not run. This boolean must be set false before you call the downloading method and set to true where the downloading is finished.
Apart from this I will suggest to load that particular page on which the user finally scrolls to rather than disabling the swipe for that you will have to do nothing onFling
just check whether the downloader thread
is alive for the last page or not if yes interrupt it and start it again for the current page I think this approach is more user friendly
精彩评论