Android jetpack compose webview, image selector not works

26 Views Asked by At

I'm developing an Android web view app, that has an image chooser option, I am making some progress, and here it is,

webChromeClient = object : WebChromeClient() {
    override fun onProgressChanged(view: WebView?, newProgress: Int) {
        super.onProgressChanged(view, newProgress)
        backEnabled = view?.canGoBack() ?: false
        loading = true
    }

    override fun onShowFileChooser(
        webView: WebView?,
        filePathCallback: ValueCallback<Array<Uri>>?,
        fileChooserParams: FileChooserParams?
    ): Boolean {
        val intent = fileChooserParams?.createIntent()
        (context as Activity).startActivityForResult(intent, 100)
        return false
    }
}

It can open the image-choosing panel, but after that it does nothing, I need to submit the image that the user selects. The image or file access permission is already taken from Manifest.

0

There are 0 best solutions below