0

I would like to be able to upload a file from an Android 4.x device, whenever I select "choose file" nothing happens.

It works when I use Chrome directly but not with the WebViewClient from within the app.

My code:

public class ActivityWebView extends MainActivity {

private WebView wv;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_webview);

    String websiteURL = "url";  

        wv = (WebView) findViewById(R.id.webView);
        wv.getSettings().setJavaScriptEnabled(true);
        wv.loadUrl(websiteURL);
        wv.setWebViewClient(new WebViewClientClass());

        wv.getSettings().setSupportZoom(false);
        wv.getSettings().setBuiltInZoomControls(false);

}

public class WebViewClientClass extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView webview, String url)
    {
        webview.loadUrl(url);
        return true;
    }

}

@Override
public boolean onKeyDown(int KeyCode, KeyEvent event)
{
    if ((KeyCode == KeyEvent.KEYCODE_BACK) && wv.canGoBack())
    {
        wv.goBack();
        return true;
    }
    return super.onKeyDown(KeyCode, event);
}
TwoStarII
  • 351
  • 3
  • 17
  • possible duplicate of [File Upload in WebView](http://stackoverflow.com/questions/5907369/file-upload-in-webview/29545290#29545290) – weiyin Apr 26 '15 at 17:11
  • possible duplicate of [HTML file input in android webview (android 4.4, kitkat)](http://stackoverflow.com/questions/19882331/html-file-input-in-android-webview-android-4-4-kitkat) – Deividi Cavarzan Apr 26 '15 at 18:23

0 Answers0