How to get loaded web page title in Android WebView? - android

I'm using a WebView in my application, I have a requirement to change the app title based on the page user is on. How can I do this in Android WebView?
I did this in iphone by following line
self.title = [webPage stringByEvaluatingJavaScriptFromString:#"document.title"]
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Adds Progrss bar Support
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.webview );
// Makes Progress bar Visible
getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
mWebView = (WebView) findViewById( R.id.webview ); //This is the id you gave
//to the WebView in the main.xml
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setSupportZoom(true); //Zoom Control on web (You don't need this
//if ROM supports Multi-Touch
mWebView.getSettings().setBuiltInZoomControls(true); //Enable Multitouch if supported by ROM
// Load URL
Bundle b = getIntent().getExtras();
String url = b.getString("url");
Log.d(TAG, "url " + url);
mWebView.loadUrl(url);
// Sets the Chrome Client, and defines the onProgressChanged
// This makes the Progress bar be updated.
mWebView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress){
//Make the bar disappear after URL is loaded, and changes string to Loading...
myActivity.setTitle("Loading...");
myActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded
// Return the app name after finish loading
if(progress == 100)
myActivity.setTitle(R.string.app_name);
}
});
mWebView.setWebViewClient(new WebViewClient(){
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
// return super.shouldOverrideUrlLoading(view, url);
}
#Override
public void onLoadResource(WebView view, String url) {
// TODO Auto-generated method stub
super.onLoadResource(view, url);
}
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
ImageView logoImageView = (ImageView)findViewById(R.id.logoimage);
logoImageView.setVisibility(View.GONE);
Log.d(TAG, "view.getTitle() " + view.getTitle());
myActivity.setTitle(view.getTitle());
}
});
}

You'll have to use a custom WebViewClient to get this done.
You will override the onPageFinished() method so when a new page finishes loading you can set the webview to the appropriate title.
Below is a sample implementation of the above:
WebView mWebView = (WebView) findViewById(R.id.mwebview);
mWebView.setWebViewClient(new WebViewClient() {
#Override
public void onPageFinished(WebView view, String url) {
ExperimentingActivity.this.setTitle(view.getTitle());
}
});
You're a going to do that where you're initializing your webview.
Replace the "ExperimentingActivity" to whatever you activity's name is.
If you're already overriding the WebViewClient, just add this function or the code inside to your already existing function.
You can get more info on the classes and functions I'm using here at:
Android Developers: Activity - setTitle()
Android Developers: WebViewClient
Android Developers: WebView

My observation is that, you get the webpage title using WebChromeClient in lesser time than using WebViewClient
webview.setWebChromeClient(new WebChromeClient() {
#Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
if (!TextUtils.isEmpty(title)) {
YourActivity.this.setTitle(title);
}
}
});

Simplest way to read title of page in Kotlin :
webView.webViewClient = object : WebViewClient() {
//....
override fun onPageFinished(view: WebView, url: String) {
val title = view.title
}
//...
}

So my experience you should use onReceivedTitle and onPageFinished both. I find that sometimes onPageFinished you won't get notify if you front end using react-router or something similar. And onReceivedTitle has flaw as #michael-levy mentioned.

private WebViewClient mWvClient = new WebViewClient() {
#Override
public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
String title = view.getTitle();//getTitle
super.doUpdateVisitedHistory(view, url, isReload);
}
}

What if you do not want the whole title, and just a Domain Name, Like if you want to show only 'Google' from www.google.com, and you have all the query parameters in this title.
URL hostUrl= new URL(webView.getUrl());
String title = hostUrl.getHost();
title = title.startsWith("www.") ? title.substring(4) : title;

get image and title from webview
Image
img.setImageBitmap(webview1.getFavicon());
Title
txt.setText(webview1.getTitle());

Related

Access remote pdf file with login (authentication)

I am facing problem with loading URL in web-view. Web-view shows blank because it is not logged in. How to access course file without login into moodle2.6 by using url.
Using this url format
http://example.com/pluginfile.php/4418/mod_resource/content/10/xx-t2.pdf
Here is my web-view code
webView.setWebViewClient(new WebViewClient(){
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//progDailog.show();
view.loadUrl(url);
return true;
}
#Override
public void onPageFinished(WebView view, final String url) {
//progDailog.dismiss();
}
});
webView.loadUrl("http://example.com/pluginfile.php/4418/mod_resource/content/10/xx-t2.pdf");
You need to append the pdf URL to Google Doc Viewer to open pdf in web view, Also you will need to enable JavaScript for your webview
public class MainActivity extends AppCompatActivity {
WebView webview;
String pageURL = "https://developer.android.com/guide/webapps/webview.html";
String pdf = "http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf"; //your pdf address
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview = findViewById(R.id.webview);
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webview.getSettings().setJavaScriptEnabled(true); // enable javascript
webview.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//progDailog.show();
view.loadUrl(url);
return true;
}
#Override
public void onPageFinished(WebView view, final String url) {
//progDailog.dismiss();
}
});
//webview.loadUrl(pageURL);
webview.loadUrl("http://drive.google.com/viewerng/viewer?embedded=true&url=" + pdf); //simply append pdf address to doc viewer
}
}
Sample PDF opened in webview
It seems that you're webclient is not calling their super methods, which could be one reason for the page to not load, use the following code to load the login page, which once signed in the user could view the intended pdf file.
webView.setWebViewClient(new WebViewClient(){
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);//<-- this is important when overriding
}
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);//<-- this is important when overriding
}
});
webView.loadUrl("https://lms.jsbl.com//pluginfile.php//4925//mod_resource//content//0//calendar_cal_605.pdf");
And also If you want you view a pdf using the webview you need append the following before your url so that the google plugin could be used to load the pdf
https://docs.google.com/gview?embedded=true&url=
(for this to work make sure you have added the following to your webview
webView.getSettings().setJavaScriptEnabled(true);webView.getSettings().setPluginState(PluginState.ON);)
According to this question some login form submit might not work on android webview so set all/some(check if your login works without it) on your webview to make the login work
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setDatabaseEnabled(true);
mWebView.getSettings().setDatabasePath(dbpath); //check the documentation for info about dbpath
mWebView.getSettings().setMinimumFontSize(1);
mWebView.getSettings().setMinimumLogicalFontSize(1);
But if you know the credentials for the login You could follow the instruction on this site to inject a javascript to the webview which would fire the Login form submit on the webview and redirect to the pdf file directly
UPDATE 16/3/2018
Use the following code which will append the google pdf widget during a redirect
and has a pdf extension
boolean isInititialRedirectComplete = false;
boolean isPdfRedirectComplete = false;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
f-inal WebView webView = (WebView) findViewById(R.id.testWebView);
webView.getSettings().setJavaScriptEnabled(true);webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.setWebViewClient(new WebViewClient(){
#Override
public void onPageFinished(WebView view, final String url) {
super.onPageFinished(view, url);
if (url.substring(url.lastIndexOf(".")).equalsIgnoreCase(".pdf") && !isPdfRedirectComplete && isInititialRedirectComplete ){
isPdfRedirectComplete = true;
webView.loadUrl("https://docs.google.com/gview?embedded=true&url=" + url);
}
isInititialRedirectComplete = true;
}
});
webView.loadUrl(
"https://lms.jsbl.com//pluginfile.php//4925//mod_resource//content//0//calendar_cal_605.pdf");
}

Android - Open URL in a WebView [duplicate]

I created an Activity that has a title and a web view in a LinearLayout. In the onResume() method it calls webView.loadUrl(url). The problem is that the activity first shows the title with the rest of the screen blank, then the device browser is launched with the page for the URL. What I want to see is the page being shown in the WebView below the title. What could be the problem?
Edit:
Ok, did some further search and found this one:
Clicking URLs opens default browser
It points to the WebView tutorial here.
Just implement the web client and set it.
Answering my question based on the suggestions from Maudicus and Hit.
Check the WebView tutorial here.
Just implement the web client and set it before loadUrl. The simplest way is:
myWebView.setWebViewClient(new WebViewClient());
For more advanced processing for the web content, consider the ChromeClient.
Use this:
lWebView.setWebViewClient(new WebViewClient());
use like this:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dedline);
WebView myWebView = (WebView) findViewById(R.id.webView1);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl("https://google.com");
}
Make your Activity like this.
public class MainActivity extends Activity {
WebView browser;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// find the WebView by name in the main.xml of step 2
browser=(WebView)findViewById(R.id.wvwMain);
// Enable javascript
browser.getSettings().setJavaScriptEnabled(true);
// Set WebView client
browser.setWebChromeClient(new WebChromeClient());
browser.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
// Load the webpage
browser.loadUrl("http://google.com/");
}
}
I was facing the same problem and I found the solution
Android's official Documentation about WebView
Here is my onCreateView() method and here i used two methods to open the urls
Method 1 is opening url in Browser and
Method 2 is opening url in your desired WebView.
And I am using Method 2 for my Application and this is my code:
public class MainActivity extends Activity {
private WebView myWebView;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_webpage_detail, container, false);
// Show the dummy content as text in a TextView.
if (mItem != null) {
/* Method : 1
This following line is working fine BUT when we click the menu item then it opens the URL in BROWSER not in WebView */
//((WebView) rootView.findViewById(R.id.detail_area)).loadUrl(mItem.url);
// Method : 2
myWebView = (WebView) rootView.findViewById(R.id.detail_area); // get your WebView form your xml file
myWebView.setWebViewClient(new WebViewClient()); // set the WebViewClient
myWebView.loadUrl(mItem.url); // Load your desired url
}
return rootView;
} }
Try this code...
private void startWebView(String url) {
//Create new webview Client to show progress dialog
//When opening a url or click on link
webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;
//If you will not use this method url links are opeen in new brower not in webview
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
//Show loader on url load
public void onLoadResource (final WebView view, String url) {
if (progressDialog == null) {
// in standard case YourActivity.this
progressDialog = new ProgressDialog(view.getContext());
progressDialog.setMessage("Loading...");
progressDialog.show();
}
}
public void onPageFinished(WebView view, String url) {
try{
if (progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}catch(Exception exception){
exception.printStackTrace();
}
}
});
// Javascript inabled on webview
webView.getSettings().setJavaScriptEnabled(true);
// Other webview options
/*
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
webView.getSettings().setBuiltInZoomControls(true);
*/
/*
String summary = "<html><body>You scored <b>192</b> points.</body></html>";
webview.loadData(summary, "text/html", null);
*/
//Load url in webview
webView.loadUrl(url);
}
If you see an empty page, enable JavaScript.
webView.setWebViewClient(new WebViewClient());
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webView.loadUrl(url);
Simply Answer you can use like this
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
setContentView(webView);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("http://www.google.com");
}
}
If you're using webChromeClient I'll suggest you to use webChromeClient and webViewClient together. because webChromeClient does not provides shouldOverrideUrlLoading. It is okay to use both.
webview.webViewClient = WebViewClient()
webview.webChromeClient = Callback()
private inner class Callback : WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) {
super.onProgressChanged(view, newProgress)
if (newProgress == 0) {
progressBar.visibility = View.VISIBLE
} else if (newProgress == 100) {
progressBar.visibility = View.GONE
}
}
}
I just found out that it depends on the formatting of the URL:
https://example.com/example gets opened in the browser
https://example.com/example/ (with / at the end) gets opened in the webView
My code just uses
webview.loadUrl(url)
no need to set
webView.setWebViewClient(new WebViewClient())
at least in my case.
Maybe that's useful for some of you.
My problem ended up being that I needed to do a clearHistory before I could switch between sites without opening an external browser.
#Override
public void onPageFinished(WebView view, String url) {
webView_.clearHistory();
super.onPageFinished(webView_, url);
}

how to get the current page url from the web view in android

Using webview.loadUrl(url) method I open an url. If I click any Button on the view it directs to another page. Now I want to get the url of the directed page. how can I get it?
I also want the content that is displayed on the webview. How to get the content of the WebView ?
String webUrl = webView.getUrl();
please see my answer
may it will help you...!!!!
WebView webview = new WebView(context);
webview.setWebViewClient(new WebViewClient()
{
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
Log.d("WebView", "your current url when webpage loading.." + url);
}
#Override
public void onPageFinished(WebView view, String url) {
Log.d("WebView", "your current url when webpage loading.. finish" + url);
super.onPageFinished(view, url);
}
#Override
public void onLoadResource(WebView view, String url) {
// TODO Auto-generated method stub
super.onLoadResource(view, url);
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
System.out.println("when you click on any interlink on webview that time you got url :-" + url);
return super.shouldOverrideUrlLoading(view, url);
}
});
I am assuming that you have set your WebViewClient.If not then you can do like below,
webView.setWebViewClient(new MyWebViewClient());
String currentUrl;
private class MyWebViewClient extends WebViewClient {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
currentUrl=url;
return true;
}
}
Here when you click on any link on the WebView then it will call shouldOverrideUrlLoading() and you can get the current url there in currentUrl.
this is the most simple way of handling this for API > 20: There are obviously other methods with parsers like HTMLCleaner to have more control. However, this is good and simple for getting URL. Each time URL changes in Webview, URL in the request object changes as well.
#Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String temp = request.getUrl().toString();
if(temp.isEmpty()){
Log.i(ActivityName, "No url returned!");
}else{
Log.i(ActivityName, temp);
}
return false;
}
you can also make your call by overriding onpagefinished method of webviewclient. I wanted to note this, since this is called when page finishes loading.

Android - Detecting WebView URL not working

I am developing an app, in that I want to detect each time when a new url gets loaded in webview and then display that url in edittext.
I tried many solution and googled. But, not found significant solution which solves my purpose..
My Code is:
wv.getSettings().setJavaScriptEnabled(true);
wv.setWebViewClient(new WebViewClient()
{
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
String url_new = wv.getUrl();
Log.v("","Webview URL: "+url_new);
edittext.setText("http://"+url_new);
return true;
}
});
Not even printing the Log Statement :(
Please Help..!!
Thanks in advance..!! :)
First off the code you're posting is returning true from shouldOverrideUrlLoading which means you've just prevented the webview from navigating to any location.
Second off, shouldOverrideUrlLoading will not get called for any urls you pass to the webview.loadUrl API. As suggested in one of the other answers, onPageStarted is the simplest API to use for this.
You can use the code below to play around with the APIs:
wv.setWebViewClient(new WebViewClient()
{
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
Log.v("","Webview shouldOverrideUrlLoading URL: " + url);
return false;
}
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon){
Log.v("","Webview onPageStarted URL: " + url);
}
});
This is the code I use in my applications.
WebView view = (WebView) findViewById(R.id.myWebView);
EditText edit = (EditText) findViewById(R.id.myEditText);
view.setWebViewClient(new WebViewClient(){
public void onPageStarted (WebView view, String url, Bitmap favicon){
edit.setText(url);
}
});
Set WebViewClient to your webview and geturl on when page finshed laoding
class MyWebView extends WebViewClient {
#Override
public void onPageFinished(WebView view, String url) {
editText.setText(view.getUrl());
}
}
set this WebViewClient to your webview ..
webView.setWebViewClient(new MyWebView());
You can override onLoadResource() method of WebViewClient :
wv.setWebViewClient(new WebViewClient() {
public void onLoadResource(WebView view, String url) {
edittext.setText("http://"+url_new);
}
}

Android webview launches browser when calling loadurl

I created an Activity that has a title and a web view in a LinearLayout. In the onResume() method it calls webView.loadUrl(url). The problem is that the activity first shows the title with the rest of the screen blank, then the device browser is launched with the page for the URL. What I want to see is the page being shown in the WebView below the title. What could be the problem?
Edit:
Ok, did some further search and found this one:
Clicking URLs opens default browser
It points to the WebView tutorial here.
Just implement the web client and set it.
Answering my question based on the suggestions from Maudicus and Hit.
Check the WebView tutorial here.
Just implement the web client and set it before loadUrl. The simplest way is:
myWebView.setWebViewClient(new WebViewClient());
For more advanced processing for the web content, consider the ChromeClient.
Use this:
lWebView.setWebViewClient(new WebViewClient());
use like this:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dedline);
WebView myWebView = (WebView) findViewById(R.id.webView1);
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl("https://google.com");
}
Make your Activity like this.
public class MainActivity extends Activity {
WebView browser;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// find the WebView by name in the main.xml of step 2
browser=(WebView)findViewById(R.id.wvwMain);
// Enable javascript
browser.getSettings().setJavaScriptEnabled(true);
// Set WebView client
browser.setWebChromeClient(new WebChromeClient());
browser.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
// Load the webpage
browser.loadUrl("http://google.com/");
}
}
I was facing the same problem and I found the solution
Android's official Documentation about WebView
Here is my onCreateView() method and here i used two methods to open the urls
Method 1 is opening url in Browser and
Method 2 is opening url in your desired WebView.
And I am using Method 2 for my Application and this is my code:
public class MainActivity extends Activity {
private WebView myWebView;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_webpage_detail, container, false);
// Show the dummy content as text in a TextView.
if (mItem != null) {
/* Method : 1
This following line is working fine BUT when we click the menu item then it opens the URL in BROWSER not in WebView */
//((WebView) rootView.findViewById(R.id.detail_area)).loadUrl(mItem.url);
// Method : 2
myWebView = (WebView) rootView.findViewById(R.id.detail_area); // get your WebView form your xml file
myWebView.setWebViewClient(new WebViewClient()); // set the WebViewClient
myWebView.loadUrl(mItem.url); // Load your desired url
}
return rootView;
} }
Try this code...
private void startWebView(String url) {
//Create new webview Client to show progress dialog
//When opening a url or click on link
webView.setWebViewClient(new WebViewClient() {
ProgressDialog progressDialog;
//If you will not use this method url links are opeen in new brower not in webview
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
//Show loader on url load
public void onLoadResource (final WebView view, String url) {
if (progressDialog == null) {
// in standard case YourActivity.this
progressDialog = new ProgressDialog(view.getContext());
progressDialog.setMessage("Loading...");
progressDialog.show();
}
}
public void onPageFinished(WebView view, String url) {
try{
if (progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}catch(Exception exception){
exception.printStackTrace();
}
}
});
// Javascript inabled on webview
webView.getSettings().setJavaScriptEnabled(true);
// Other webview options
/*
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
webView.getSettings().setBuiltInZoomControls(true);
*/
/*
String summary = "<html><body>You scored <b>192</b> points.</body></html>";
webview.loadData(summary, "text/html", null);
*/
//Load url in webview
webView.loadUrl(url);
}
If you see an empty page, enable JavaScript.
webView.setWebViewClient(new WebViewClient());
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webView.loadUrl(url);
Simply Answer you can use like this
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
setContentView(webView);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("http://www.google.com");
}
}
If you're using webChromeClient I'll suggest you to use webChromeClient and webViewClient together. because webChromeClient does not provides shouldOverrideUrlLoading. It is okay to use both.
webview.webViewClient = WebViewClient()
webview.webChromeClient = Callback()
private inner class Callback : WebChromeClient() {
override fun onProgressChanged(view: WebView?, newProgress: Int) {
super.onProgressChanged(view, newProgress)
if (newProgress == 0) {
progressBar.visibility = View.VISIBLE
} else if (newProgress == 100) {
progressBar.visibility = View.GONE
}
}
}
I just found out that it depends on the formatting of the URL:
https://example.com/example gets opened in the browser
https://example.com/example/ (with / at the end) gets opened in the webView
My code just uses
webview.loadUrl(url)
no need to set
webView.setWebViewClient(new WebViewClient())
at least in my case.
Maybe that's useful for some of you.
My problem ended up being that I needed to do a clearHistory before I could switch between sites without opening an external browser.
#Override
public void onPageFinished(WebView view, String url) {
webView_.clearHistory();
super.onPageFinished(webView_, url);
}

Categories

Resources