Skip to content

Instantly share code, notes, and snippets.

@apuravchauhan
Created May 27, 2019 14:23
Show Gist options
  • Save apuravchauhan/39fae2de890ff34db71779f99bbbf315 to your computer and use it in GitHub Desktop.
Save apuravchauhan/39fae2de890ff34db71779f99bbbf315 to your computer and use it in GitHub Desktop.
package com.apuravchauhan.apuravupi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
/**
* @author apuravchauhan
*/
public class MainActivity extends AppCompatActivity {
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = findViewById(R.id.activity_main_webview);
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(new WebAppInterface(this), "ApuSDK");
// REMOTE RESOURCE
// mWebView.loadUrl("https://www.google.com");
// LOCAL RESOURCE
mWebView.loadUrl("file:///android_asset/index.html");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment