Example usage for android.provider OpenableColumns SIZE

List of usage examples for android.provider OpenableColumns SIZE

Introduction

In this page you can find the example usage for android.provider OpenableColumns SIZE.

Prototype

String SIZE

To view the source code for android.provider OpenableColumns SIZE.

Click Source Link

Document

The number of bytes in the file identified by the openable URI.

Usage

From source file:com.fa.mastodon.activity.ComposeActivity.java

private static long getMediaSize(ContentResolver contentResolver, Uri uri) {
    long mediaSize;
    Cursor cursor = contentResolver.query(uri, null, null, null, null);
    if (cursor != null) {
        int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE);
        cursor.moveToFirst();//from  w  w  w  . j  av a  2s.  c om
        mediaSize = cursor.getLong(sizeIndex);
        cursor.close();
    } else {
        mediaSize = MEDIA_SIZE_UNKNOWN;
    }
    return mediaSize;
}