title: can't open file chooser in WebView Android 4.4.2 using WebChromeClient
body: <p>In my webview by clicking <strong>"Choose File"</strong> button In samsung 7 inch tablet I want to open a File Browser, but I can't open this in <strong><em>Android Version 4.4.2</em></strong>.
  So can u plz help me for this?
  Here is my Code.</p>
  
  <p><strong>WebViewDemo.java</strong></p>
  
  <pre><code>package com.example.webviewdemo;
  
  import java.io.File;
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.content.res.Configuration;
  import android.graphics.Bitmap;
  import android.net.Uri;
  import android.os.Bundle;
  import android.os.Environment;
  import android.os.Parcelable;
  import android.provider.MediaStore;
  import android.webkit.ConsoleMessage;
  import android.webkit.ValueCallback;
  import android.webkit.WebChromeClient;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.webkit.WebSettings.PluginState;
  import android.widget.ProgressBar;
  import android.widget.Toast;
  
  public class WebViewDemo extends Activity {
      /** Called when the activity is first created. */
  
      WebView web;
  
      private ValueCallback&lt;Uri&gt; mUploadMessage;
      private final static int FILECHOOSER_RESULTCODE=1;
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode,
                                      Intent intent) {
          if(requestCode==FILECHOOSER_RESULTCODE)
          {
              if (null == mUploadMessage) return;
              Uri result = intent == null || resultCode != RESULT_OK ? null
                      : intent.getData();
              mUploadMessage.onReceiveValue(result);
              mUploadMessage = null;
          }
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.show_web_view);
  
          web = (WebView) findViewById(R.id.webView1);
  
          web = new WebView(this);
          web.getSettings().setJavaScriptEnabled(true);
          web.loadUrl("file:///android_asset/select.html");
          web.setWebViewClient(new myWebClient());
          web.setWebChromeClient(new WebChromeClient()
          {
              //The undocumented magic method override
              //Eclipse will swear at you if you try to put @Override here
              // For Android 3.0+
              public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg) {
  
                  mUploadMessage = uploadMsg;
                  Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                  i.addCategory(Intent.CATEGORY_OPENABLE);
                  i.setType("image/*");
                  WebViewDemo.this.startActivityForResult(Intent.createChooser(i,"File Chooser"), FILECHOOSER_RESULTCODE);
  
              }
  
              // For Android 3.0+
              public void openFileChooser( ValueCallback uploadMsg, String acceptType ) {
                  mUploadMessage = uploadMsg;
                  Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                  i.addCategory(Intent.CATEGORY_OPENABLE);
                  i.setType("*/*");
                  WebViewDemo.this.startActivityForResult(
                          Intent.createChooser(i, "File Browser"),
                          FILECHOOSER_RESULTCODE);
              }
  
              //For Android 4.1
              public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg, String acceptType, String capture){
                  mUploadMessage = uploadMsg;
                  Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                  i.addCategory(Intent.CATEGORY_OPENABLE);
                  i.setType("image/*");
                  WebViewDemo.this.startActivityForResult( Intent.createChooser( i, "File Chooser" ), WebViewDemo.FILECHOOSER_RESULTCODE );
  
              }
  
          });
  
  
          setContentView(web);
  
  
      }
  
      public class myWebClient extends WebViewClient
      {
          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
              // TODO Auto-generated method stub
              super.onPageStarted(view, url, favicon);
          }
  
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
              // TODO Auto-generated method stub
  
              view.loadUrl(url);
              return true;
  
          }
  
          @Override
          public void onPageFinished(WebView view, String url) {
              // TODO Auto-generated method stub
              super.onPageFinished(view, url);
  
          }
      }
  
      //flipscreen not loading again
      @Override
      public void onConfigurationChanged(Configuration newConfig){
          super.onConfigurationChanged(newConfig);
      }
  
  // To handle "Back" key press event for WebView to go back to previous screen.
  /*@Override
  public boolean onKeyDown(int keyCode, KeyEvent event)
  {
      if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; web.canGoBack()) {
          web.goBack();
          return true;
      }
      return super.onKeyDown(keyCode, event);
  }*/
  }
  </code></pre>
  
  <p><strong>Inside assets/select.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div data-role="page" id="pageone"&gt;
    &lt;div data-role="header"&gt;
    &lt;h1&gt;PRODUCT DETAIL&lt;/h1&gt;
    &lt;/div&gt;
  
  &lt;div data-role="content"&gt;
  &lt;form method="get" action=""&gt;
  
     &lt;div data-role="fieldcontain"&gt;
      &lt;label for="name"&gt;Open File Chosser And Select File From Camera :&lt;/label&gt;
      &lt;input type="file" name="text" id="name" type="image/*" &gt;
      &lt;/div&gt;
    &lt;div data-role="fieldcontain"&gt;
      &lt;label for="name"&gt;Email:&lt;/label&gt;
      &lt;input type="text" name="text" id="name" value="" placeholder="What's Your Name?"&gt;
      &lt;/div&gt;
  
      &lt;div data-role="fieldcontain"&gt;
      &lt;label for="search"&gt;Looking for anything?&lt;/label&gt;
      &lt;input type="search" name="search" id="search" value="" placeholder="Search for content"/&gt;
    &lt;/div&gt;
  
    &lt;div data-role="fieldcontain"&gt;
      &lt;label for="colors"&gt;&lt;a href="http://www.androidexample.com/media/webview/webview_browser.html"&gt;Open link in webview browser.&lt;/a&gt;&lt;/label&gt;
      &lt;br&gt;
      &lt;br&gt;
      &lt;label for="colors"&gt;&lt;a href="http://www.google.com/"&gt;Open link in new browser.&lt;/a&gt;&lt;/label&gt;
  
   &lt;/div&gt;
  
     &lt;/div&gt;
  
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>