android - I can't dismiss ProgressDialog when webvView has completed loading the webpage -
android - I can't dismiss ProgressDialog when webvView has completed loading the webpage -
i want dismiss progressdialog when webview completed loading webpage, isn't working me. here code :
bundle com.mcc.ghurbo; import java.security.publickey; import android.app.activity; import android.app.progressdialog; import android.content.context; import android.content.intent; import android.os.bundle; import android.os.handler; import android.os.message; import android.view.window; import android.webkit.websettings; import android.webkit.webview; import android.webkit.webviewclient; public class ghurboactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); setcontentview(r.layout.main); final webview mywebview=(webview)findviewbyid(r.id.webview); mywebview.getsettings().setjavascriptenabled(true); mywebview.setwebviewclient(new webviewclient()); final progressdialog p=new progressdialog(ghurboactivity.this); p.show(ghurboactivity.this, "", "loading..."); thread loading=new thread(){ public void run(){ seek { mywebview.loadurl("http://www.google.com"); } //end of seek catch(exception e ){ e.printstacktrace(); }// end of grab finally{ p.dismiss(); }//end of }//end of run };//end of thread loading.start(); }
please help me possible. can't proceed farther work without solving problem
try next approach show progress dialog webview
webview.setwebviewclient(new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { // start progress dialog view.loadurl(url); homecoming true; } @override public void onpagefinished(webview view, string url) { //hide progress dialog loading has finished } });
it certainly help u
android multithreading webview progressdialog
Comments
Post a Comment