Copy Code code as follows:
Package Com.weizhu.lan.view;
Import Com.weizhu.lan.util.MyprogressDialog;
Import android.app.Activity;
Import Android.app.AlertDialog;
Import Android.content.Context;
Import android.content.Intent;
Import Android.net.ConnectivityManager;
Import Android.os.AsyncTask;
Import Android.os.Bundle;
Import Android.os.Handler;
Import android.view.KeyEvent;
Import Android.view.Window;
Import android.webkit.WebChromeClient;
Import Android.webkit.WebView;
Import Android.widget.ProgressBar;
public class HelpCenter extends activity {
50766649
Private String urlhelp = "Http://www.jb51.net",
UserID = "userid=";
Private String Yqhid;
Private WebView web;
Private Handler hand;
Private ProgressBar PB;
Private Myasynctask Myasy;
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Requestwindowfeature (Window.feature_no_title);
Setcontentview (R.layout.help_webview);
Yqhid = Getintent (). Getstringextra ("Yqhid");
web = (webview) Findviewbyid (R.ID.HELP_WEBVIEW1);
Web.getsettings (). Setbuiltinzoomcontrols (True); Can zoom in, zoom out
Myasy = new Myasynctask ();
Final String str = urlhelp;
Myasy.execute (str);
}
Class Myasynctask extends Asynctask<string, String, void>{
@Override
Protected Void doinbackground (String ... params) {
Web.loadurl (Params[0]);
Web.setwebchromeclient (New Webchromeclient () {
@Override
public void onprogresschanged (webview view, int newprogress) {
Super.onprogresschanged (view, newprogress);
Pb.setprogress (newprogress); It will handle the progress bar itself.
}
});
return null;
}
@Override
protected void OnPostExecute (void result) {
}
@Override
protected void OnPreExecute () {
PB = (ProgressBar) Findviewbyid (R.ID.HELP_PROGRESSBAR2);
Pb.setprogress (0);
}
}
}