[英]How to get track Uri from ContentResolver query?
i am traversing in the phone's memory with the following code. 我正在使用以下代码遍历手机的内存。
ContentResolver contentResolver = getContentResolver();
String[] columns = {
MediaColumns._ID,
MediaColumns.TITLE,
AudioColumns.DURATION,
};
final String where = MediaStore.Audio.Media.IS_MUSIC + "=1";
Cursor cursor = contentResolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,columns, where, null, null);
while(cursor.moveToNext()) {
String urp = cursor.getString(cursor.getColumnIndex(MediaColumns._ID));
String title = cursor.getString(cursor.getColumnIndex(MediaColumns.TITLE));
Long duration = cursor.getLong(cursor.getColumnIndex(AudioColumns.DURATION));
}
so now my question is, how to get the uri of the cursor items traveresed, like for first while run i have stored id,title,duration etc metadata and i would also like to store that tracks URI, also i would like to convert that URI from content// scheme to file scheme. 所以现在我的问题是,如何获取游标项目的uri,比如第一次运行时,我已经存储了id,title,duration等元数据,我还想存储跟踪URI的内容,我也想将其转换从内容//方案到文件方案的URI。
Any help will be greatful thankyou 任何帮助将不胜感激
String.valueOf(cur.getColumnIndex(android.provider.MediaStore.MediaColumns.DATA)));
http://android-er.blogspot.fr/2011/04/convert-uri-to-real-path-format.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.