android.provider.MediaStore.Video.Media Java Examples

The following examples show how to use android.provider.MediaStore.Video.Media. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileUtils.java    From styT with Apache License 2.0 6 votes vote down vote up
public static String getPath(Context context, Uri uri) {
    if (uri == null) {
        return null;
    }
    String string;
    if (uri.getScheme().compareTo("content") == 0) {
        Cursor query = context.getContentResolver().query(Media.EXTERNAL_CONTENT_URI, null, null, null, null);
        if (query == null || !query.moveToFirst()) {
            return null;
        }
        string = query.getString(query.getColumnIndexOrThrow("_data"));
        query.close();
        return string;
    } else if (uri.getScheme().compareTo("file") != 0) {
        return null;
    } else {
        string = uri.toString();
        return uri.toString().replace("file://", "");
    }
}
 
Example #2
Source File: FileUtils.java    From stynico with MIT License 6 votes vote down vote up
public static String getPath(Context context, Uri uri) {
    if (uri == null) {
        return null;
    }
    String string;
    if (uri.getScheme().toString().compareTo("content") == 0) {
        Cursor query = context.getContentResolver().query(Media.EXTERNAL_CONTENT_URI, null, null, null, null);
        if (query == null || !query.moveToFirst()) {
            return null;
        }
        string = query.getString(query.getColumnIndexOrThrow("_data"));
        query.close();
        return string;
    } else if (uri.getScheme().compareTo("file") != 0) {
        return null;
    } else {
        string = uri.toString();
        return uri.toString().replace("file://", "");
    }
}
 
Example #3
Source File: VideoList.java    From droidddle with Apache License 2.0 5 votes vote down vote up
public HashMap<String, String> getBucketIds() {
    Uri uri = mBaseUri.buildUpon().appendQueryParameter("distinct", "true").build();
    Cursor c = Images.Media.query(mContentResolver, uri, new String[]{Media.BUCKET_DISPLAY_NAME, Media.BUCKET_ID}, whereClause(), whereClauseArgs(), sortOrder());
    try {
        HashMap<String, String> hash = new HashMap<String, String>();
        while (c.moveToNext()) {
            hash.put(c.getString(1), c.getString(0));
        }
        return hash;
    } finally {
        c.close();
    }
}
 
Example #4
Source File: VideoList.java    From droidddle with Apache License 2.0 4 votes vote down vote up
protected String whereClause() {
    return mBucketId != null ? Images.Media.BUCKET_ID + " = '" + mBucketId + "'" : null;
}
 
Example #5
Source File: VideoList.java    From droidddle with Apache License 2.0 4 votes vote down vote up
@Override
protected Cursor createCursor() {
    Cursor c = Images.Media.query(mContentResolver, mBaseUri, VIDEO_PROJECTION, whereClause(), whereClauseArgs(), sortOrder());
    return c;
}