title: Use intent to upload files to Google Drive
body: <p>I am getting the error: "Upload failed. Failed to schedule 1 file for upload". I am trying to create a simple file explorer. When user taps on a non-folder item on listView, a Google Drive upload dialog will appear but I got the error when i tap on SAVE button from Google Drive dialog. Below shows my coding. Please do tell me what or which parts I am doing wrong. Thank you.</p>
  
  <pre><code>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.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
          currentDir = new File(o.getPath());
          fill(currentDir);
      }
      else
      {
          onFileClick(o);
      }
  }
  
  private void onFileClick(Option o)
  {
      Toast.makeText(this, "File Clicked: "+o.getName(), Toast.LENGTH_SHORT).show();
      String uri = o.getPath();
      Uri uploadUri = Uri.parse(uri);
      Toast.makeText(this, "This file is located at: "+uploadUri, Toast.LENGTH_SHORT).show();
      if (uri.contains(".txt")) {
          Intent uploadIntent = ShareCompat.IntentBuilder.from(this)
                  .setText("Share Document")
                  .setType("application/txt")
                  .setStream(uploadUri)
                  .getIntent()
                  .setPackage("com.google.android.apps.docs");
          startActivity(uploadIntent);
      }else{
          //TODO: what to do when it is other file format
      }
  }
  </code></pre>