First of all i am a newbie and I am trying to get the media files details using mediastore and saving the details in the List mitems
. Here is what I am doing
public class MusicRetriever {
final String TAG = "MusicRetriever";
ContentResolver mContentResolver;
// the items (songs) we have queried
List<Item> mItems = new ArrayList<Item>();
Here I am getting the file details from internal and external uri and saving them in arraylist
. But I am not able to get the details of particular column. This is what i am trying
public class Item {
long id;
String artist;
String title;
String album;
long duration;
public Item(long id, String artist, String title, String album, long duration) {
this.id = id;
this.artist = artist;
this.title = title;
this.album = album;
this.duration = duration;
}
public long getId() {
return id;
}
public String getArtist() {
return artist;
}
public String getTitle() {
return title;
}
public String getAlbum() {
return album;
}
public long getDuration() {
return duration;
}
public Uri getURI() {
return ContentUris.withAppendedId(
android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, id);
}
}
How I can get the following details as an array from Item class in another class or fragment.
you can get your array item like this. exthis is the example
if you want set your data to listview you can set like this.
first set this variable globally.
and in onCreate Method use like this:
I hope it works.