Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:17:12+00:00 2026-06-05T19:17:12+00:00

I am trying to get a list of Files in a Folder from Google

  • 0

I am trying to get a list of Files in a Folder from Google Drive from my Android app but have been unsuccessful so far. I’m using google-api-drive-v1-rev4-java-1.6.0-beta and google-api-client-1.9.0. I’m also building my code similar to calendar-android-sample and tasks-android-sample from the samples at http://code.google.com/p/google-api-java-client/wiki/Android.

I cant seem to find how to use files() to get a list of folders or even the id of the folder I want. The tasks-android-sample uses ‘@default’ in the get() method to get a list of tasks. What would I use in the get method to get a list of folders first, search for my folder, get the id, then get a list of files in that folder?

AsyncLoadDocs.java: (Note: I’m using getFields() just to see if the Get object contains any metadata, which at this point doesn’t.)

package com.mysite.myapp.docs;

import com.google.api.services.drive.Drive;
import com.google.api.services.drive.Drive.Files;
import com.google.api.services.drive.Drive.Files.Get;
import com.google.api.services.drive.model.File;

import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ArrayAdapter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Asynchronously load the docs with a progress dialog.
 *
 * @author ms
 */
class AsyncLoadDocs extends AsyncTask<Void, Void, List<String>> {

private static final String TAG = "AsyncLoadDocs";
private final GDocsSync gDocsSync;
private final ProgressDialog dialog;
private final Drive entry = null;
private com.google.api.services.drive.Drive service;

  AsyncLoadDocs(GDocsSync gDocsSync) {
    this.gDocsSync = gDocsSync;
    service = gDocsSync.driveClient;
    dialog = new ProgressDialog(gDocsSync);
  }

  @Override
  protected void onPreExecute() {
    dialog.setMessage("Loading docs...");
    dialog.show();
  }

  @Override
  protected List<String> doInBackground(Void... arg0) {
    try {
      List<String> folderNames = new ArrayList<String>();

      Get get = service.files().get("@default").setProjection("FULL");
      String fields = get.getFields();
      Log.d(TAG, "Fields: " + fields);

      return folderNames;
    } catch (IOException e) {
        gDocsSync.handleGoogleException(e);
      return Collections.singletonList(e.getMessage());
    } finally {
        gDocsSync.onRequestCompleted();
    }
  }

  @Override
  protected void onPostExecute(List<String> result) {
    dialog.dismiss();
  }
}

Any help would be appreciated. Both Calendar and Tasks samples successfully retrieve data from Google using my API key, why doesn’t this Drive code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:17:14+00:00Added an answer on June 5, 2026 at 7:17 pm

    The Drive API grants access only to two classes of files:

    • Files that a user has created with a given Drive app
    • Files that a user opens with a given Drive app

    For security reasons, there’s no method to list all files in a user Drive account:

    https://developers.google.com/drive/apps_overview#granting_file-level_access

    For more options in the Android environment, check out these other answers:

    • Android API for Google Drive?
    • Google Drive\Docs API for Android
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a list of all files in a folder from
I am trying to get Update queries from a list of files using this
Trying to get a list of all substrings currently I have a function but
Trying to make a dropdown list, displaying files from a specific folder, with a
I'm having trouble trying to get attributes from files in my list. The code
I am trying to get list of numbers from: numbers= 1,2 to: '1','2' I
I am trying to get a list of hrefs from a list of ten
I have been trying to get a basic reorderlist working following this guide ->
Here is my code: I am trying to get the CSV files from a
I am trying to copy over some files pulled out from a zip folder,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.