I'm trying to make an app with a webview of facebook.com, i want to load custom css but i don't know how. I searched on Google but found old tutorials and i read that it has changed in Android Studio 2.0
Here is my code:
private WebView myWebView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myWebView = (WebView)findViewById(R.id.webView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl("https://www.facebook.com/");
myWebView.setWebViewClient(new WebViewClient());
}
Related
I want to load a login page with JavaScript but I couldn't get the JavaScript to load even though i made a setJavaScriptEnabled(true)
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = webView.getSettings();
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://itsikkerhed.talentlms.com/index");
}
Try to enable DomStorage: webView.getSettings().setDomStorageEnabled(true);
When I build and run the application I see only black screen,The html file is using java script,video,audio file and images,I used these codes
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.loadUrl("file:///android_asset/aici/index.html");
}
I am working on my first android project which is based on Google Forms.
I've done pretty much everything except my main part which is showing forms in webview. The form is getting display but the Sign In button is not clickable.
public class cadexpo extends AppCompatActivity {
private static WebView browser;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cadexpo);
browser = (WebView) findViewById(R.id.webView);
browser.getSettings().getJavaScriptEnabled();
WebSettings browser = browser.getSettings();
browser.loadUrl("https://drive.google.com/open?id=1VLKIncq9bTJnWqxbOHc3foTeSLykP7AQyL0Si1cIQ1I");
Please help me in fixing it.
Enable javascript for webview
WebSettings webSettings = browser.getSettings();
webSettings.setJavaScriptEnabled(true);
I am new to Android development and I am trying to make an app for my video website which has videos from YouTube.
The problem I am having right now is that the embedded iframe videos don't show the fullscreen button. I have been searching for a solution but have yet to find one that works for me.
mainActivity.java:
public class MainActivity extends Activity {
private WebView wv1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.webView);
WebView myWebView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
wv1=(WebView)findViewById(R.id.webView);
wv1.setWebChromeClient(new WebChromeClient() {
});
wv1.setWebViewClient(new MyBrowser());
wv1.loadUrl("http://m.youtube.com");
} .....
Thanks for any help.
I try to show local HTML in webview but it showing error.
Here's the source
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView wv= (WebView) findViewById(R.id.wv);
wv.getSettings().setPluginsEnabled(true); //error here
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
wv.loadUrl("file:///android_asset/index.html");
}
I hope someone can help me.
"This method was deprecated in API level 18. Plugins will not be supported in future, and should not be used."
see the question wich brings you the nswer : setPluginEnabled is undefined