SortableMetadataField | 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
  - Tools & Reference
  - Developer Stories

## Results

Loading...
public interface

# SortableMetadataField

implements MetadataField<T>

com.google.android.gms.drive.metadata.SortableMetadataField<T>

## Class Overview

Interface for metadata fields that can be used to sort results of the file queries. Implementation of this interface (such as the static values in `SortableField`) can be add sorting criteria for the file or folder queries.

For example, the following code will find all files that are starred, have the MIME type type "text/plain" and list them in the order they were created:

     Filter starredFilter = Filters.eq(SearchableField.STARRED, true);
     Filter mimeTypeFilter = Filters.eq(SearchableField.MIME_TYPE, "text/plain");
     Query query = new Query.Builder()
                            .addFilters(starredFilter, mimeTypeFilter)
                            .addSortAscending(SortableField.CREATED_DATE)
                            .build();
     for (Metadata metadata : Drive.DriveApi.query(apiClient, query).await().getMetadataBuffer()) {
         System.out.println(metadata.getTitle());
     }