Posts

Showing posts from September, 2017

How to make bridge between Android and JavaScript

Now days Web Mobile apps and Hybrid applications are on trends.  This blog is about how we can make a bridge between Web form and android native methods in android apps using JavaScript. Let's start with add basic code to create bridge. First of all create Android project in Android Studio. Create an Activity class and layout file. Now open layout file of activity and add EditText( for typing a message), add button for sending message to webpage and WebView for loading webpage. Your xml layout look like:- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "vertical" tools:context= "com.aman.webviewcallback.MainActivity" > <EditText a