Skip to content

Instantly share code, notes, and snippets.

@basith374
Created July 2, 2020 09:42
Show Gist options
  • Save basith374/59baf300fd374ef056a630a5bc67e124 to your computer and use it in GitHub Desktop.
Save basith374/59baf300fd374ef056a630a5bc67e124 to your computer and use it in GitHub Desktop.
android webview splash
import kotlinx.android.synthetic.main.activity_main.webview;
import kotlinx.android.synthetic.main.activity_main.splash;
class MainActivity : Activity() {
private class MyWebViewClient() : WebViewClient() {
override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url)
splash.setVisibility(View.INVISIBLE); // can't call function on this reference
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
webview.webViewClient = MyWebViewClient()
webview.loadUrl("https://example.com")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment