android - Delay popping up a dialog fragment till a webview within has completed loading -
i have dialog fragment contains single web view. want dialog popup once web view has completed loading url.
this oncreateview
of dialogfragment
public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.dialog_a, container, false); webview = (webview) view.findviewbyid(r.id.web_view); webview.clearcache(true); webview.loadurl(url); }
the problem have web view object created after oncreateview()
method called called after show()
called; in turn cause dialog popup.
is there anyway can preload web view before popup dialog?
i wouldnt use dialogfragment because of lifecycle of fragment. u want load webview prior showing user. therefore use customlayout visibility=gone , when webview (inside layout) finish loading ill fadein layout. use framelayout , put @ topof hierarchy.
Comments
Post a Comment