Код: Выделить всё
String[] mediaAttrs = {
MediaStore.Audio.Media.TITLE,
MediaStore.Audio.Media.DATA,
MediaStore.Audio.Media.ARTIST,
MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.DURATION,
MediaStore.Audio.Media.DATE_ADDED,
};
mCursor = context.getContentResolver().query(
MediaStore.Audio.Media.INTERNAL_CONTENT_URI,mediaAttrs,null,null,null);
String[] excludeLocations = {"/system","/storage/emulated/0/Ringtones"};
boolean locationInclude = true;
while(mCursor.moveToNext()){
String mediaLocation = mCursor.getString(mediaLocationIndex);//required column index
for(String eachLocation:excludeLocations){
if(mediaLocation.startsWith(eachLocation)) {
Log.e("LocationTest:Excluded"," "+mediaLocation);
locationInclude = false;
}
}
if(locationInclude){
Log.e("LocationTest:Included"," "+mediaLocation);
this.insert( ... );//insert found data
}
locationInclude = true;
}
Код: Выделить всё
Cursor mPlayListCursor = mDB.getWritableDB().query(
Audio,//table name
new String[]{"_id","mediaLocation"},
null,null,null,null, "mediaLocation"+" ASC"
);
SimpleCursorAdapter mAudioAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1,
mCursor,
new String[]{"mediaLocation"},
new int[]{android.R.id.text1},0
);
ListView lv = findViewById(R.id.mListView);
lv.setAdapter(mAudioAdapter);
Код: Выделить всё
/storage/emulated/0/Ringtones/hangouts_incoming_call.oggКод: Выделить всё
/storage/emulated/0/Ringtones/hangouts_message.ogg
Подробнее здесь: https://stackoverflow.com/questions/614 ... -ringtones
Мобильная версия