Here are the examples of the java api class com.google.android.gms.drive.DriveId taken from open source projects.
1. DriveHelper#getOrCreateFile()
Project: iosched
File: DriveHelper.java
File: DriveHelper.java
/** * Get or create the {@link DriveFile} named with {@code fileName} with * the specific {@code mimeType}. * * @return Return the {@code DriveId} of the fetched or created file. */ public DriveId getOrCreateFile(String fileName, String mimeType) { LOGD(TAG, "getOrCreateFile " + fileName + " mimeType " + mimeType); DriveId file = getDriveFile(fileName, mimeType); LOGD(TAG, "getDriveFile returned " + file); if (file == null) { return createEmptyDriveFile(fileName, mimeType); } else { return file; } }
2. BackupAdapter#getView()
Project: glucosio-android
File: BackupAdapter.java
File: BackupAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(getContext()); v = vi.inflate(R.layout.activity_backup_drive_restore_item, null); } GlucosioBackup p = getItem(position); final DriveId driveId = p.getDriveId(); final String modified = formatDateTime.formatDate(p.getModifiedDate()); final String size = humanReadableByteCount(p.getBackupSize(), true); if (p != null) { TextView modifiedTextView = (TextView) v.findViewById(R.id.item_history_time); TextView typeTextView = (TextView) v.findViewById(R.id.item_history_type); modifiedTextView.setText(modified); typeTextView.setText(size); } v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Show custom dialog final Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.dialog_backup_restore); TextView createdTextView = (TextView) dialog.findViewById(R.id.dialog_backup_restore_created); TextView sizeTextView = (TextView) dialog.findViewById(R.id.dialog_backup_restore_size); Button restoreButton = (Button) dialog.findViewById(R.id.dialog_backup_restore_button_restore); Button cancelButton = (Button) dialog.findViewById(R.id.dialog_backup_restore_button_cancel); createdTextView.setText(modified); sizeTextView.setText(size); restoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((BackupActivity) context).downloadFromDrive(driveId.asDriveFile()); } }); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); return v; }