Tuesday, 6 March 2018

Webview in android

WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application.
 First Add Permissions in Android : -
  <uses-permission android:name="android.permission.INTERNET" />  
MainActivity.java: -  
package safal.bhatia.webview;
 import android.content.Intent;
 import android.net.Uri;
 import android.support.v7.app.AppCompatActivity;
 import android.os.Bundle;
 import android.view.View;
import android.webkit.WebView;
 import android.widget.TextView;  
public class MainActivity extends AppCompatActivity
WebView web_view;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
web_view = (WebView) findViewById(R.id.web_view); web_view.loadUrl("http://www.javatpoint.info"); web_view.setHorizontalScrollBarEnabled(false); //When we use java Script web_view.getSettings().setJavaScriptEnabled(true);
 Xml File activity_main.xml: -
  <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
 <WebView android:layout_width="match_parent"


  1. When I faced such as this one of yours, I wasn't feeling mazed at some level or something. Actually, I studied the Java programming for 2 solid years, so I know for sure that this thing is pretty common among a great variety of users. Back then, I was using many sources and even those "teach yourself coding everything in 2 minutes" books to obtaiт as much information as I can. But one resource of them I keep using nowadays as well. In general, these are the java tutorials explainjava.com/category/java/java-core/ but written in quite easy to understand language, so even somebody with zero experience in coding at all could get it. And it comes in use to me as a handbook to find the answers for all the common issues I'm forgetting myself frequently. But anyway, I was pretty surprised about how easily this one can be solved here