title: Files Chooser for Xamarin Forms Not adding the selected image taken from camera and file
body: <p>I'm creating a mobile application using Xamarin forms, As part of my implementation, I have a requirement to to show file chooser on clicking on camera icon which is loaded in webView and load the image to webView. currently file chooser is being shown, but image is not getting added.</p>
  <pre><code>public override bool OnShowFileChooser(Android.Webkit.WebView webView, Android.Webkit.IValueCallback filePathCallback, FileChooserParams fileChooserParams) {
  
      Intent takePictureIntent = new Intent(MediaStore.ActionImageCapture);
  
      if (takePictureIntent.ResolveActivity(mContext.PackageManager) != null) {
  
          Java.IO.File photoFile = null;
  
          try {
              string folder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
              photoFile = new Java.IO.File(folder, &quot;image&quot; + DateTime.Now.Millisecond + &quot;.png&quot;);
              takePictureIntent.PutExtra(&quot;PhotoPath&quot;, mCameraPhotoPath);
  
              //photoFile = createImageFile();
              //takePictureIntent.PutExtra(&quot;PhotoPath&quot;, mCameraPhotoPath);
          } catch (Exception e) {
              Console.WriteLine(&quot;catch the Exception&quot; + e);
          }
          if (photoFile != null) {
              mCameraPhotoPath = &quot;file:&quot; + photoFile.AbsolutePath;
              //pictureUri = FileProvider.GetUriForFile(mContext, &quot;asdasd&quot;, photoFile);
              takePictureIntent.PutExtra(Android.Provider.MediaStore.ExtraOutput, photoFile);
          } else {
              takePictureIntent = null;
          }
  
      }
  
      Intent contentSelectionIntent = new Intent(Intent.ActionGetContent);
      contentSelectionIntent.AddCategory(Intent.CategoryOpenable);
      contentSelectionIntent.SetType(file_type);
  
      Intent[] intentArray;
      if (takePictureIntent != null) {
          intentArray = new Intent[] {
              takePictureIntent
          };
      } else {
          intentArray = new Intent[0];
      }
  
      Intent chooserIntent = new Intent(Intent.ActionChooser);
      chooserIntent.PutExtra(Intent.ExtraIntent, contentSelectionIntent);
      chooserIntent.PutExtra(Intent.ExtraTitle, &quot;File chooser&quot;);
      chooserIntent.PutExtra(Intent.ExtraInitialIntents, intentArray);
  
      //mContext.StartActivity(chooserIntent);
      mContext.StartActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
      return true;
  
  }
  
  private Java.IO.File createImageFile() {
      // Create an image file name
      string timeStamp = Android.OS.SystemClock.CurrentThreadTimeMillis().ToString();
      string imageFileName = &quot;JPEG_&quot; + timeStamp + &quot;_&quot;;
      Java.IO.File storageDir;
  
      if (Android.OS.Build.VERSION.SdkInt &gt;= Android.OS.BuildVersionCodes.Gingerbread) {
          storageDir = mContext.CacheDir;
  
      } else {
          storageDir = mContext.GetExternalFilesDir(Android.OS.Environment.DirectoryPictures);
      }
      //new Java.IO.File(mContext.GetExternalFilesDir(null).AbsolutePath);
      Java.IO.File imageFile = Java.IO.File.CreateTempFile(
          imageFileName, /* prefix */
          &quot;.jpg&quot;, /* suffix */
          storageDir /* directory */
      );
  
      return imageFile;
  
  }
  </code></pre>