android - how to resolve unusual time delay problem in webview content loading -
i'm facing unusual problem while loading webview new content.
imagine ebook reader app im going implement...
app allows user swap(fling) screen backward , forward see chapter content(nothing reading book).
book contains several chapters , i'm keeping each chapter in separate webpage
when activity begins load first chapter in webview.
i'm loading new chapter 1 chapter ends (user unaware of loading new page web view turning pages forward , backward)
after first chapter 2,3,4 ..n chapters..
as going next chapter need allow user come previous chapter.
in condtion imagine if user finishes chapter 1 , come chapter 2 . user may want refer previous page. should load chapter 1.
i can loading previous chapter. content visible user should not beginning of chapter should end of chapter. im scrolling end of chapter see end of below code. logic not working ..
public void fling(...){ //swap forward if (end_of_page==false) scrollby(480); else if (end_of_page==true) webview.load(); //load next chapter //swap backward if beginning_of_chapter==true && previous_chapter_exists==true webview.load(); //load previous chapter scrollby(10000); //scroll 10000 px can end of chapterbut problem here webview not scrolls upto 10000px. bcoz statement scrollby(10000); executes before previous chapter loaded webview (i.e bcoz of delay in webview loading).
how can solve problem?
use onpagefinished processing after page loaded.
Comments
Post a Comment