title: How to fetch files and folders from my google drive to show these in my app?
body: <p>Here is my code: </p>
  
  <pre><code>private void listfiles(Drive s )throws IOException
    {
    Toast.makeText(getApplicationContext(), "Inside listfiles now", Toast.LENGTH_LONG).show();
    List&lt;File&gt; result = new ArrayList&lt;File&gt;();
      Files.List request = s.files().list();
      Toast.makeText(getApplicationContext(), "list extracted", Toast.LENGTH_LONG).show();
      do {
          try {
               Toast.makeText(getApplicationContext(), "executing", Toast.LENGTH_LONG).show();
  
            FileList files = request.execute();
  
            Toast.makeText(getApplicationContext(), "Executed", Toast.LENGTH_LONG).show();
            result.addAll(files.getItems());
            request.setPageToken(files.getNextPageToken());
          } catch (IOException e) {
              Toast.makeText(getApplicationContext(), "Inside catch", Toast.LENGTH_LONG).show();
            System.out.println("An error occurred: " + e);
  
            request.setPageToken(null);
          }
        } while (request.getPageToken() != null &amp;&amp;
                 request.getPageToken().length() &gt; 0);
  }
  </code></pre>
  
  <p>Please tell me how to do this. I really need it, I have been trying for a long time.</p>