Skip to content

Instantly share code, notes, and snippets.

@chiragthummar
Created January 4, 2024 06:30
Show Gist options
  • Save chiragthummar/d413dd66dc10fb4d21acc637c0e9dff6 to your computer and use it in GitHub Desktop.
Save chiragthummar/d413dd66dc10fb4d21acc637c0e9dff6 to your computer and use it in GitHub Desktop.
import android.content.Context
import android.webkit.JavascriptInterface
import android.widget.Toast
class JavaScriptInterface {
private val context : Context
constructor(context : Context){
this.context = context
}
@JavascriptInterface
fun showToast(str : String){
Toast.makeText(context, "Message Received From Java Script $str", Toast.LENGTH_SHORT).show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment