When I open a Document file (by URL link), i want to show it in WebView
, but when I connecting the URL link, my application doesn't show it in WebView
, it is opened in chrome.
When i disable google chrome, it shown in WebView
, but when I enable chrome, the same thing happened again.
Please help me to resolve this issue.
This is my code: MainActivity
btnAccess.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = edtAddress.getText().toString();
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
intent.putExtra("LINK","http://"+ url);
startActivity(intent);
/*accessURL();*/
}
});
Main2Activity:
webView = (WebView) findViewById(R.id.webView);
Intent intent = getIntent();
String url = getIntent().getStringExtra("LINK");
webView = new WebView(Main2Activity.this);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setJavaScriptEnabled(true);
setContentView(webView);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.loadUrl("http://docs.google.com/gview?embedded=true&url="+ url);
setContentView(webView);