title: Google Drive API - populating list of files in ListView
body: <p>I am using the demo found here as a guide for my app:</p>
  
  <p><a href="https://github.com/googledrive/android-demos/tree/master/src/com/google/android/gms/drive/sample/demo" rel="nofollow">https://github.com/googledrive/android-demos/tree/master/src/com/google/android/gms/drive/sample/demo</a></p>
  
  <p>I am first using the PickFolderWithOpenerActivity.java to retrieve the Google Drive folder responseID. I want the user to first drill down and select a folder, and then all the files in that folder to be displayed (and to be selectable)</p>
  
  <p>The OpenFileActivityBuilder opens ok in my app and I can then browse the folder structure, and then press the "Select" button in order to select that folder.</p>
  
  <p>In PickFolderWithOpenerActivity.java, I am overwriting the EXISTING_FOLDER_ID with the <strong>responseID</strong> (this response ID matches the drive folder URL i.e. the part in bold: <a href="https://drive.google.com/?authuser=0#folders/" rel="nofollow">https://drive.google.com/?authuser=0#folders/</a><strong>0AwbfSlc3Y1XYUXpZU0Vac1JXY28</strong>):</p>
  
  <p>So essentially, EXISTING_FOLDER_ID = 0AwbfSlc3Y1XYUXpZU0Vac1JXY28</p>
  
  <pre><code>DriveId driveId = (DriveId) data.getParcelableExtra(
                              OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID);
      EXISTING_FOLDER_ID = driveId.getResourceId();
  </code></pre>
  
  <p>I then call the  the "ListFilesInFolderActivity.java":</p>
  
  <pre><code>public class ListFilesInFolderActivity extends BaseActivity  {
  
  private ListView mResultsListView;
  private ResultsAdapter mResultsAdapter;
  //private static DriveId sFolderId = DriveId.decodeFromString(EXISTING_FOLDER_ID); // this causes error
  
  @Override
  public void onConnected(Bundle connectionHint) {
      super.onCreate(connectionHint);
      setContentView(R.layout.activity_listfiles);
      mResultsListView = (ListView) findViewById(R.id.listViewResults);
      mResultsAdapter = new ResultsAdapter(this);
      mResultsListView.setAdapter(mResultsAdapter);
  
      showMessage("EXISTING_FOLDER_ID:" + EXISTING_FOLDER_ID);
      Drive.DriveApi.fetchDriveId(getGoogleApiClient(), EXISTING_FOLDER_ID)
              .setResultCallback(idCallback);
  
  
  
  }
  
  final private ResultCallback&lt;DriveIdResult&gt; idCallback = new ResultCallback&lt;DriveIdResult&gt;() {
      @Override
      public void onResult(DriveIdResult result) {
          if (!result.getStatus().isSuccess()) {
              showMessage("Cannot find DriveId. Are you authorized to view this file?");
              return;
          }
          DriveFolder folder = Drive.DriveApi.getFolder(getGoogleApiClient(), result.getDriveId());
          showMessage("Result driveId is:  " + result.getDriveId());
          folder.listChildren(getGoogleApiClient())
                  .setResultCallback(metadataResult);
  
  
  
      }
  };
  
  final private ResultCallback&lt;MetadataBufferResult&gt; metadataResult = new
          ResultCallback&lt;MetadataBufferResult&gt;() {
              @Override
              public void onResult(MetadataBufferResult result) {
                  if (!result.getStatus().isSuccess()) {
                      showMessage("Problem while retrieving files");
                      return;
                  }
                  mResultsAdapter.clear();
                  mResultsAdapter.append(result.getMetadataBuffer());
  
                  showMessage("Successfully listed files.");
                  Intent intent2 = new Intent(ListFilesInFolderActivity.this, ListFilesActivity.class);
                  startActivity(intent2);
              }
          };
  </code></pre>
  
  <p>}</p>
  
  <p>This completes ok as I receive the following message:</p>
  
  <pre><code> showMessage("Successfully listed files.");
  </code></pre>
  
  <p>I then call the ListFilesInFolderActivity which I think is populating the ListView (when I say call, I am using a new intent to show the activity).</p>
  
  <p>But the problem is that only the top level folders and files are listed in the ListView. Not the files from the selected folder.</p>
  
  <p>My intention is  to display all the files from that "picked" folder and make them selectable (multi select).</p>
  
  <p>I tried using the "PickFileWithOpenerActivity" but it only lets you choose one file from google drive.  I want to be able to select multiple files in a folder.  (I take it there is no way to change that)</p>
  
  <p>Could someone take a look at the sample code and let me know if there is anything I need to change to get the ListView to populate with <em>all</em> the files from the SELECTED folder, (and to make the list multi selectable)?</p>
  
  <p>Should I not be using responseID at all?  Should I only be using driveId?</p>
  
  <p>Thanks</p>