how to set WebView in android studio

 Set your application on latest gradle version and now is running mostly androidx.

you should carry it with android x.

you have to set this code in your application and 

XML Code


<WebView
android:id="@+id/webv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
java code is 
WebView webView = findViewById(R.id.webv);
webView.loadUrl("set your web address");
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);

Comments

Popular posts from this blog

How to add clear button in android Studio.

How to set Backpressed botton in android studio