I download last version of android studio , keep all up to date.
VERSION is 2.2.2 .
I cant find how to remove tester browser from my app . I just wanna to use webView control not browser tester .
I fixed it. I forgot to add this line:
WebView.setWebViewClient(new WebViewClient());
What heppend was that it actually opened the browser after redirecting instead of the WebView.
For some reason it opens this webview tester instead of the browser, so it's misleading.
Full code:
WebView webview = (WebView)findViewById(R.id.webView);
webview .setWebViewClient(new WebViewClient());
webView.loadUrl("https://...");
Related
On some pages of my website there are options to upload files and content. I have created a webview application out of the website using android studio. In my application, when I click upload contents, nothing happens. It doesn't open any directory to upload.
But, if I use the website from a mobile browser it works fine and when I press 'attach', it opens up the phones's directory/storage which is not the case for my webview app. What is the problem with my android application?
Any suggestion will be greatly appreciated. Thank you.
Please enable javascript using webview.getSettings().setJavaScriptEnabled(true);
Here is the idea what I'm trying to do.
My app is around 24MB. I want to break it into modules using google instant app. My idea is I will implement a WebView in which I will load my website which is a dashboard. Now what I want is when a person clicks on any item from the dashboard, the related instant app is loaded. So the user will install only the module which he needed.
Now coming to the problem- How can I open an instant app for my app WebView. I'm able to do it with chrome.
Ok, I have solved it. Just set the webview chrome client and it will able to detect instant app from the link.
webView.setWebChromeClient(new WebChromeClient());
I am new to Cordova android development.
I want to open the specified URLs within the application instead of opening up it in browser.
I know I have to use WebView but I need help for how to use the WebView.
How to implement Cordova WebView for cordova android application?
We don't need to take an any external webview. Your complete cordova app will run by default in webview and URL directly will load into webview.
To redirect URL use,
location.href = "pageName.html";
OR
load page like
<iframe src="http://www.google.com"></iframe>
I am having the webview, which will be created using the following code.
WebView mWebView=new WebView(this);
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.addJavascriptInterface(new AndroidJavaInterface(), "JavaInterface");
Is this webview is same as the chrome.? If I am loading any URL into this webview using loadurl() method, and running in two different devices, Is the webview is same in all the devices?. I think it will run on the customized mWebView or Is the app pick the device's default browser for loading URL?
EDIT 1: I have created the webview in android version 2.2. That is API 8. If I am running the app in android 4.1 device. Is the webview version is changed or the webview is remain same for all the devices with different versions?
No, Webview widget is not Chrome.
You can implement a WebView adding some behaviour like Javascript and Java, but IT WILL NEVER BE LIKE A BROWSER (less performance,less capability...).
Well according to my knowledge WebView and Chrome browser are different.
WebView is an Android widget which is used to display local and remote web pages. Even though it has got some features of a browser like rendering JavaScript, it cannot be considered as a fully fledged browser.
Please refer Developer Site for more details.
I am having a problem running a HTML5 Youtube embedded in a WebView.
I want to play a Youtube video on my application. I decided to use WebView instead of VideoView, because I want to make my system more flexible to play video from web.
Although There are many ways to get play youtube on the android, but I will use the youtube embedded version. "http://www.youtube.com/embed/___________________". Because this is one of the solution I found when your android doesn't support flash.
The problem:
The WebView load as normal including the embedded Youtube. But I get a black screen on the youtube at start.
When I click on it. It load the first Image only but then It is not Playing. I tried to play on the android browser, it works smoothly but not in the webView.
Any idea why?
Below is just a snip of my code:
WebView wv = new WebView(getApplicationContext());
wv.getSettings().setPluginState(PluginState.ON);
wv.getSettings().setJavaScriptEnabled(true);
wv.loadUrl("http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html");
setContentView(wv);
Here are some of the resources that I found very useful:
How can we play YouTube embeded code in an Android application using webview?
play youtube video in WebView
How to embed a YouTube clip in a WebView on Android
http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html
http://www.broken-links.com/2009/10/06/building-html5-video-controls-with-javascript/
http://www.youtube.com/embed/bHQqvYy5KYo
Thank you in advance for any support and help :)
Update (13 June 2011):
I successfully load the http://m.youtube.com inside the WebView, but unable to play any video. But When I tried to load the URL on my Android Browser, it can play.
From here, I notice that the youtube site from my WebView is not signed in. So How can we allow the WebView to use the same credential as my Youtube account in my phone? Will it actually works?
Step 1 : Simply add this to Manifest file
android:hardwareAccelerated="true"
step 2 : check if you are setting layer for your webview.
(i.e.)
//myWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
setting hardware acceleration to true and commenting these lines worked for me .
To know more about Hardware Acceleration and Layers look here at http://developer.android.com/guide/topics/graphics/hardware-accel.html
EDIT
So from the comment conversation we have deducted:
On this website: www.youtube.com/html5 it says you have to sign in then opt in for HTML5 video playback
That is why your video will not load, it is redirecting to a flash version and your webview does not have flash.
ORIGINAL
Are you overriding url loading so your webview is being used?
wv.setWebViewClient(new WebViewClient(){
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
Are you saying the video won't play but the website loads?
You could try lying to YouTube and telling them your a different browser (perhaps pretend to be the android browser) Firefox is:
wv.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.36 (KHTML, like Gecko) Chrome/13.0.766.0 Safari/534.36");