title: Android file chooser is not opening from WebView in Lollipop nor Marshmallow
body: <p>I'm developing an app, that uses a <code>WebView</code> to access some logic. The logic, has a part where the user can upload a picture, but, I can't seem to find a way for the app to do so.<br>
  The code I'm using as example is in this <a href="http://androidexample.com/Open_File_Chooser_With_Camera_Option_In_Webview_File_Option/index.php?view=article_discription&amp;aid=128&amp;aaid=148" rel="nofollow">link</a>.</p>
  
  <p>As you will see, a custom <code>Intent</code> is set from the <code>WebChromeClient</code>, however, the file chooser does not open at all. Code:
  <br></p>
  
  <pre><code>public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg, String acceptType){  
  
                  // Update message
                  mUploadMessage = uploadMsg;
  
                  try{    
  
                      // Create AndroidExampleFolder at sdcard
  
                      File imageStorageDir = new File(
                                             Environment.getExternalStoragePublicDirectory(
                                             Environment.DIRECTORY_PICTURES)
                                             , "AndroidExampleFolder");
  
                      if (!imageStorageDir.exists()) {
                          // Create AndroidExampleFolder at sdcard
                          imageStorageDir.mkdirs();
                      }
  
                      // Create camera captured image file path and name 
                      File file = new File(
                                      imageStorageDir + File.separator + "IMG_"
                                      + String.valueOf(System.currentTimeMillis()) 
                                      + ".jpg");
  
                      mCapturedImageURI = Uri.fromFile(file); 
  
                      // Camera capture image intent
                      final Intent captureIntent = new Intent(
                                                    android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  
                      captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
  
                      Intent i = new Intent(Intent.ACTION_GET_CONTENT); 
                      i.addCategory(Intent.CATEGORY_OPENABLE);
                      i.setType("image/*");
  
                      // Create file chooser intent
                      Intent chooserIntent = Intent.createChooser(i, "Image Chooser");
  
                      // Set camera intent to file chooser 
                      chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS
                                             , new Parcelable[] { captureIntent });
  
                      // On select image call onActivityResult method of activity
                      startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);
  
                    }
                   catch(Exception e){
                       Toast.makeText(getBaseContext(), "Exception:"+e, 
                                  Toast.LENGTH_LONG).show();
                   }
  
              }
  </code></pre>
  
  <p>Thanks in advance!
  <br>
  <strong>EDIT</strong></p>
  
  <p>So, after @JoxTraex enlightened me, I realized that the file chooser was not triggering because I was not overriding any methods of the <code>WebChromeClient</code>. Now, the file chooser is prompting, but, if a select an image, the image doesn't get uploaded.<br>
  The code I'm using for the file chooser:</p>
  
  <pre><code>@Override
              public boolean onShowFileChooser(WebView webView, ValueCallback&lt;Uri[]&gt; filePathCallback, FileChooserParams fileChooserParams) {
                  openFileChooser(filePathCallback, "");
                  return super.onShowFileChooser(webView, filePathCallback, fileChooserParams);
              }
  
              public void openFileChooser(ValueCallback&lt;Uri[]&gt; uploadMsg, String acceptType){
                  // Update message
                  //mUploadMessage = uploadMsg.this;
                  try{
                      // Create AndroidExampleFolder at sdcard
                      File imageStorageDir = new File(
                              Environment.getExternalStoragePublicDirectory(
                                      Environment.DIRECTORY_PICTURES)
                              , "AndroidExampleFolder");
  
                      if (!imageStorageDir.exists()) {
                          // Create AndroidExampleFolder at sdcard
                          imageStorageDir.mkdirs();
                      }
  
                      // Create camera captured image file path and name
                      File file = new File(
                              imageStorageDir + File.separator + "IMG_"
                                      + String.valueOf(System.currentTimeMillis())
                                      + ".jpg");
  
                      mCapturedImageURI = Uri.fromFile(file);
  
                      // Camera capture image intent
                      final Intent captureIntent = new Intent(
                              android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  
                      captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
  
                      Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                      i.addCategory(Intent.CATEGORY_OPENABLE);
                      i.setType("image/*");
  
                      // Create file chooser intent
                      Intent chooserIntent = Intent.createChooser(i, "Image Chooser");
  
                      // Set camera intent to file chooser
                      chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS
                              , new Parcelable[] { captureIntent });
  
                      // On select image call onActivityResult method of activity
                      startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);
  
                  }
                  catch(Exception e){
                      Toast.makeText(getBaseContext(), "Exception:"+e,
                              Toast.LENGTH_LONG).show();
                  }
  
              }
  </code></pre>
  
  <p>Thanks in advance!</p>