I want to be able to choose and/or create a new folder in Google Drive using UI for the user and also save that folder id for later use.
Right now I'm using:
IntentSender intentSender = Drive.DriveApi
.newOpenFileActivityBuilder()
.build(mGoogleApiClient);
try {
Log.d(TAG, "Startar UI");
startIntentSenderForResult(
intentSender, 5, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
Log.i(TAG, "Failed to launch file chooser.");
}
}
It works but it's not ideal for the purpose. The only other newActivityBuilder I could find was createFile which have the same problems.
Is there any workarounds for making this work?
Use EXTRA_RESPONSE_DRIVE_ID to get the DriveId from the result.( https://developers.google.com/android/reference/com/google/android/gms/drive/OpenFileActivityBuilder.html#EXTRA_RESPONSE_DRIVE_ID )
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case 5:
if (resultCode == RESULT_OK) {
DriveId driveId =
(DriveId) data.getParcelableExtra(OpenFileActivityBuilder.EXTRA_RESPONSE_DRIVE_ID);
}
break;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.