chore. bump version, print media id
This commit is contained in:
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId "at.lockstep"
|
applicationId "at.lockstep"
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 1
|
versionCode 10002
|
||||||
versionName "1.0"
|
versionName "1.0.2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
|
|||||||
@@ -106,15 +106,17 @@ public class MediaStoreBenchmarkActivity extends Activity {
|
|||||||
MediaStore.Audio.Media.TITLE + " ASC"
|
MediaStore.Audio.Media.TITLE + " ASC"
|
||||||
)) {
|
)) {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
|
int idColumn = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
|
||||||
int titleColumn = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE);
|
int titleColumn = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE);
|
||||||
int dataColumn = cursor.getColumnIndex(MediaStore.Audio.Media.DATA);
|
int dataColumn = cursor.getColumnIndex(MediaStore.Audio.Media.DATA);
|
||||||
|
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
|
String contentUri = cursor.getString(idColumn); // the content:// Uri for the MediaStore item
|
||||||
String title = cursor.getString(titleColumn);
|
String title = cursor.getString(titleColumn);
|
||||||
String path = dataColumn != -1 ? cursor.getString(dataColumn) : null;
|
String path = dataColumn != -1 ? cursor.getString(dataColumn) : null;
|
||||||
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
musicList.add(title + "\n" + path);
|
musicList.add(title + "\n" + path + "\n" + contentUri);
|
||||||
} else {
|
} else {
|
||||||
musicList.add(title + "\n[path unavailable]");
|
musicList.add(title + "\n[path unavailable]");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user