Reputation: 17269
Can html input file be used in android webview? If not, what are the workarounds?
<input type="file" name="file />
Upvotes: 2
Views: 4574
Reputation: 13785
WebView by default doesn't open file chooser. However it is possible to make this work. WebChromeClient has hidden method openFileBrowser, which needs to be overridden to pop up a file chooser and then return the result to WebView
But I would think that you could modify things such that an onClick event on the would call into Java code that you inject via [addJavascriptInterface()][1], at which point you can bring up whatever sort of "file explorer" you want.
http://m0s-programming.blogspot.in/2011/02/file-upload-in-through-webview-on.html
Upvotes: 5