In my JsonParsing and i got the url from this json. I need to display that Url link as in webview. How should i do that?
Code is here:
TextView tv = (TextView)findViewById(R.id.textView1);
Bundle bundle = new Bundle();
bundle = getIntent().getExtras();
String id = bundle .getString("id");
String firstName = bundle.getString("firstName");
String lastName = bundle.getString("lastName");
String headline = bundle.getString("headline");
String pictureUrl = bundle.getString("pictureUrl");
String url = bundle.getString("url");
Log.v("LV","id :"+id+"\n"+"firstname :"+firstName+"\n"+"lastname :"+lastName+"\n"+"headline :"+headline+"\n"+"pictureUrl :"+pictureUrl+"\n"+"siteStandardProfileRequest"+url);
tv.setText("id :"+id+"\n"+"firstname :"+firstName+"\n"+"lastname :"+lastName+"\n"+"headline :"+headline+"\n"+"pictureUrl :"+pictureUrl+"\n"+"Profile URL :"+url);
as you have ask for url open in webview so you have to take one webview in your project and do like this
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
// you need to setWebViewClient for forcefully open in your webview
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
and other way is (this will open in web browser)
Intent browserIntent = new Intent(Intent.ACTION_VIEW,uri.parse(url));
startActivity(browserIntent);
Use This Code:
webView = (WebView) findViewById(R.id.webView1);
progressDialog = ProgressDialog.show(MainActivity.this, "", "Loading...",true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.getSettings().setAllowFileAccess(true);
webView.loadUrl("http://example.com/shidhin/test.html"); // Here You can put your Url
webView.setWebChromeClient(new WebChromeClient() {
});
webView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
public void onPageFinished(WebView view, String url) {
progressDialog.dismiss();
//Toast.makeText(context, "Page Load Finished", Toast.LENGTH_SHORT).show();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With