title: Android : How to get file data from a Filechooser?
body: <p>I have a filechooser that I call in a webview in order to upload a file.
  The method allowing me to retrieve the file in my filechooser activity is as follows :</p>
  
  <pre><code>@Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
      // TODO Auto-generated method stub
      super.onListItemClick(l, v, position, id);
      Option o = adapter.getItem(position);
      if (o.isFolder() || o.isParent()) {
          currentDir = new File(o.getPath());
          fill(currentDir);
      } else {
          //onFileClick(o);
          fileSelected = new File(o.getPath());
          Intent intent = new Intent();
          intent.putExtra("fileSelected", fileSelected.getAbsolutePath());
          setResult(Activity.RESULT_OK, intent);
          finish();
      }
  }
  </code></pre>
  
  <p>This only allows me to get the path in the <code>onActivityResult of my webview</code> (which calls my filechooser to upload file).
  The method <code>onActivityResult</code> is given by the code below. </p>
  
  <p>If I use another application installed in my phone other than my filechooser I use :</p>
  
  <pre><code>Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
  </code></pre>
  
  <p>then the result is sent by:</p>
  
  <pre><code> this.mUploadMessage.onReceiveValue(uri);
  </code></pre>
  
  <p>Since then, it works normally. But with my filechooser <code>intent.getData ()</code> equals to  <code>null</code>.</p>
  
  <pre><code> @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
          if (requestCode == FILECHOOSER_RESULTCODE) {
              if (null == this.mUploadMessage) {
                  return;
              }
              if (resultCode != RESULT_OK) {
                  mUploadMessage.onReceiveValue(null);
                  var = 0;
                  return;
              }
             // Toast.makeText(getApplicationContext() , "onActivityResult()" + String.valueOf(requestCode) ,Toast.LENGTH_LONG).show();
             // Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
  
  
             // this.mUploadMessage = null;
              String fileSelected = intent.getStringExtra("fileSelected");
              Bundle result = intent.getExtras();
              //result =   Uri.parse(fileSelected);
  
              //this.mUploadMessage.onReceiveValue(result);
  
              if (resultCode == RESULT_OK) {
                  if (intent != null) {
                      // Get the URI of the selected file
                      final Uri uri = intent.getData();
                      Log.i("TOTOTOT", "Uri = " + uri.toString());
                      Toast.makeText(this, fileSelected + "   " + uri.toString() , Toast.LENGTH_SHORT).show();
                      this.mUploadMessage.onReceiveValue(uri);
                  }
              }
             super.onActivityResult(requestCode, resultCode, intent);
  
          }
      }
  </code></pre>
  
  <p>What should I return in my two methods in order to retrieve both data and path, not only the path of the sent file ? Should it be all the bundle or do you know how to get Data while using Intent.getData()?</p>