fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class CheckFolderGoogleDrive
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. // controllo se esiste la cartella dell'applicazione
  14. GoogleApiClient mGoogleApiClient = oActivity.getGoogleApiClient();
  15.  
  16. DriveFolder root = Drive.DriveApi.getRootFolder(mGoogleApiClient);
  17. Query query = new Query.Builder()
  18. .addFilter(Filters.eq(SearchableField.TITLE, sNameFolderGoogleDrive))
  19. .addFilter(Filters.eq(SearchableField.TRASHED, false))
  20. .build();
  21.  
  22. root.queryChildren(mGoogleApiClient, query).setResultCallback(metadataSearchFolderCallback);
  23. }
  24.  
  25. final private ResultCallback<DriveApi.MetadataBufferResult> metadataSearchFolderCallback = new
  26. ResultCallback<DriveApi.MetadataBufferResult>() {
  27. @Override
  28. public void onResult(DriveApi.MetadataBufferResult result) {
  29. if (!result.getStatus().isSuccess()) {
  30. try { throw new Exception("Problem while retrieving files"); } catch (Exception e) { Log.d(MainActivity.CODE_LOG, "" + e.getMessage()); }
  31. return;
  32. }
  33.  
  34. GoogleApiClient mGoogleApiClient = (oActivity).getGoogleApiClient();
  35. MetadataBuffer buffer = result.getMetadataBuffer();
  36. Log.d(TAG, "Folder count " + buffer.getCount());
  37.  
  38. if (buffer.getCount() == 0) {
  39.  
  40. // creo la cartella in google drive
  41.  
  42.  
  43. } else {
  44.  
  45. // ho già la cartella
  46.  
  47.  
  48. }
  49.  
  50. }
  51. };
  52. }
  53.  
  54.  
  55. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:62: error: class, interface, or enum expected
}
^
1 error
stdout
Standard output is empty