DriveId | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
public class

# DriveId

extends Object
implements Parcelable

java.lang.Object
↳ | com.google.android.gms.drive.DriveId

## Class Overview

A canonical identifier for a Drive resource. The identifier can be converted to a String representation for storage using `encodeToString()` and then later converted back to the ID representation using `decodeFromString(String)`. `equals(Object)` can be used to see if two different identifiers refer to the same resource.

## Summary

Constants
int | RESOURCE_TYPE_FILE | A file resource type, meaning the `DriveId` corresponds to a file.
int | RESOURCE_TYPE_FOLDER | A folder resource type, meaning the `DriveId` corresponds to a folder.
int | RESOURCE_TYPE_UNKNOWN | An unknown resource type, meaning the `DriveId` corresponds to either a file or a folder.

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final Creator<DriveId> | CREATOR |

Public Methods
static DriveId | decodeFromString(String s) Decodes the result of `encodeToString()` back into a `DriveId`.
int | describeContents()
final String | encodeToString() Returns a String representation of this `DriveId` that can be safely persisted, and from which an equivalent `DriveId` can later be reconstructed using `decodeFromString(String)`.
boolean | equals(Object obj)
String | getResourceId() Returns the remote Drive resource id associated with the resource.
int | getResourceType() Returns the resource type corresponding to this `DriveId`.
int | hashCode()
String | toString() Returns a String representation of the ID.
void | writeToParcel(Parcel out, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final int RESOURCE_TYPE_FILE

A file resource type, meaning the `DriveId` corresponds to a file.

Constant Value: 0 (0x00000000)

#### public static final int RESOURCE_TYPE_FOLDER

A folder resource type, meaning the `DriveId` corresponds to a folder.

Constant Value: 1 (0x00000001)

#### public static final int RESOURCE_TYPE_UNKNOWN

An unknown resource type, meaning the `DriveId` corresponds to either a file or a folder.

Constant Value: -1 (0xffffffff)

## Fields

#### public static final Creator<DriveId> CREATOR

## Public Methods

#### public static DriveId decodeFromString (String s)

Decodes the result of `encodeToString()` back into a `DriveId`.

##### Throws

IllegalArgumentException | if the argument is not a valid result of `encodeToString()`.

#### public int describeContents ()

#### public final String encodeToString ()

Returns a String representation of this `DriveId` that can be safely persisted, and from which an equivalent `DriveId` can later be reconstructed using `decodeFromString(String)`.

The String representation is not guaranteed to be stable over time for a given resource so should never be compared for equality. Always use `decodeFromString(String)` and then `equals(Object)` to compare two identifiers to see if they refer to the same resource.

#### public boolean equals (Object obj)

#### public String getResourceId ()

Returns the remote Drive resource id associated with the resource. May be `null` for local resources that have not yet been synchronized to the Drive service.

#### public int getResourceType ()

Returns the resource type corresponding to this `DriveId`. Possible values are `RESOURCE_TYPE_FILE`, `RESOURCE_TYPE_FOLDER` or `RESOURCE_TYPE_UNKNOWN`.

The `RESOURCE_TYPE_UNKNOWN` will only be returned if the `DriveId` instance has been created using `decodeFromString(String)`, with an old string that was generated and persisted by the client with an old version of Google Play Services. If the client is not encoding, persisting and decoding `DriveId`s, this method will always return either `RESOURCE_TYPE_FILE` or `RESOURCE_TYPE_FOLDER`.

#### public int hashCode ()

#### public String toString ()

Returns a String representation of the ID. Use `encodeToString()` to obtain a String representation that can decoded back to a `DriveId`.

#### public void writeToParcel (Parcel out, int flags)