Skip to content

Instantly share code, notes, and snippets.

@IhwanID
Last active July 3, 2019 04:08
Show Gist options
  • Select an option

  • Save IhwanID/edcf193929e2129cc1cf6b084080ebc1 to your computer and use it in GitHub Desktop.

Select an option

Save IhwanID/edcf193929e2129cc1cf6b084080ebc1 to your computer and use it in GitHub Desktop.
webview class
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>
class WebViewActivity : Activity() {
@SuppressLint("SetJavaScriptEnabled")
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_webview)
val webView = findViewById<WebView>(R.id.webView)
webView.settings.javaScriptEnabled = true
webView.loadUrl(intent.getStringExtra("url"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment