pre-load a webview on android so user doesn't have to wait for the slow loading time -
i'm making app main content te user wants view in form of html pages, i'm porting app on iphone , want reuse pages because there 100 of them , recreating them android layouts quite time consuming. problem on android webview takes 4-5 seconds load first time open page , couple seconds each subsequent time.
i searched , found similar answer don't know if work situation(preload webview). answer suggests using viewflipper multiple webviews loaded when switch between them instantly loaded. don't know if work me because have 100 different pages cache(although optimize down 30 max loading ones user can navigate current page) , because webviews in different activity button user clicks view page. i.e user looking @ listview 30 different options pages view, when click listview entry opens activity webview , have wait until user made click begin loading webviews, theres no way shave off loading time there.
i suppose since listview , webview activities same, small view title either webview or list underneath of it, consolidate 1 activity , have listview webviews in view flipper , thing lose transition between listview activity , webview one, not big deal. solution work? should cache 30 webview pages? don't think viable solution , want ask if better me android programming has better solution. if preload 1 page enough, although not optimal, because takes couple seconds load 2nd 3rd 4th etc... pages.
tl:dr - webview takes 5 seconds load first page , couple each 1 after that. wan't make instant if isn't possible want @ least preload first one(idk html page load until user clicks option btw, , there 100 different options) doesn't take 5 seconds. right i'm looking @ finding way preload/cache 30 pages users options loaded might use memory. considering finding way open activity in background , load webview whatever page, doesnt matter, through initial 5 second load time.
sorry had trouble wording reason, hope can follow i'm trying do. thanks
oh btw - of html stored locally in assets folder , i'm using webview.loadurl("file:///android_asset/about cards.html"); etc load pages
Comments
Post a Comment