1
I’ve tried everything but my webview doesn’t work. help me
the java code
public class Telairlanda extends Appcompatactivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tela_irlanda);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
WebView wv=(WebView)findViewById(R.id.webView1);
WebSettings ws = wv.getSettings();
ws.setJavaScriptEnabled(true);
ws.setSupportZoom(false);
wv.loadUrl("https://www.google.com");
What doesn’t work? See if this reply resolves.
– ramaral
The code is correct, but look if you put internet access permission
– Natanael Nicolas
I put the permission in the manifest <? xml version="1.0" encoding="utf-8"? > <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.junior.intercambio"> <uses-permission android:name="android.permission.INTERNET"></uses-permission>
– Junior Machado
Then try to put "wv.setWebViewClient(new Webviewclient());" before loadUrl
– Natanael Nicolas
Hello, You are trying on android 6? if yes it is necessary to request permission at runtime https://inducesmile.com/android-6-marshmallow-runtime-permissions-request-example/
– João
@Joãofelipe The permission
android.permission.INTERNET
does not belong to the list of dangerous permissions, therefore your request at runtime is not necessary.– ramaral