Monday, 2 September 2013

How to get url dynamically and pass it to webview within my code?

How to get url dynamically and pass it to webview within my code?

pI have been searching quite long for a solution but haven't found
anything usable. All I want is that for my url to be updated automatically
in webview after the administrator of the url posts something new and the
adress changes./p precodeimport android.app.Activity; import
android.os.Bundle; import android.view.Window; import
android.webkit.WebChromeClient; import android.webkit.WebView; import
android.webkit.WebViewClient; public class tutorialOne extends Activity {
final Activity activity = this; @Override public void onCreate(Bundle
savedInstanceState) { super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.avarii); WebView webView = (WebView)
findViewById(R.id.webview1);
webView.getSettings().setJavaScriptEnabled(true);//enable java content
webView.getSettings().setUseWideViewPort(false);//enable zoom-out page
webView.getSettings().setDomStorageEnabled(true);
webView.setWebChromeClient(new WebChromeClient() { public void
onProgressChanged(WebView view, int progress) { activity.setTitle(Se
incarca datele...); activity.setProgress(progress * 100); if(progress ==
100) activity.setTitle(R.string.app_name); } });
webView.setWebViewClient(new WebViewClient() { @Override public void
onReceivedError(WebView view, int errorCode, String description, String
failingUrl) { // Handle the error } @Override public boolean
shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url);
return true; } });
webView.loadUrl(https://www.aquaserv.ro/index.php?npage=757); } }
/code/pre

No comments:

Post a Comment