-1
我已經創建文件夾到谷歌驅動器,但每次我運行應用程序,相同的文件夾創建到我的谷歌驅動器。我只是想找到方法如何避免在谷歌drive.my代碼聽到相同的文件夾創建。如果任何人有解決這個問題比讓我知道。如何創建文件夾,如果不存在於谷歌驅動器在Android使用谷歌驅動器Api?
@Override
public void onConnected(Bundle bundle) {
Log.i(TAG, "API client connected.");
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle("Testing1").build();
Drive.DriveApi.getRootFolder(mGoogleApiClient).createFolder(mGoogleApiClient,changeSet).setResultCallback(callback); }
final ResultCallback<DriveFolder.DriveFolderResult> callback = new ResultCallback<DriveFolder.DriveFolderResult>() {
@Override
public void onResult(DriveFolder.DriveFolderResult result) {
if (!result.getStatus().isSuccess()) {
Toast.makeText(getApplicationContext(), "Error while trying to create the folder", Toast.LENGTH_SHORT).show();
return;
}
Toast.makeText(getApplicationContext(), "Created a folder: " + result.getDriveFolder().getDriveId(), Toast.LENGTH_SHORT).show();
}
};
你沒有回答這個問題。 – stef