• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps how to send the mediainfo using MediaStore to my Custom List Adapter in Android?

boblingwide

Lurker
Sep 15, 2013
2
0
Q1: how to get the media information of all the video in sd card getting the Image, Title, and Artist of the video and put it in my custom list adapter that acept and Array of Image, Array of Titles, Array of Artist, How to do that?

Thanks!


My Custom List Adapter Class - accept array of img from video, titles, artist
[HIGH]class MyCustomAdapter extends ArrayAdapter<String> {

Context context;
int[] imgArray;
String[] titlesArray;
String[] infoArray;

public MyCustomAdapter(Context context, int[] img, String[] titles,
String[] artist) {
super(context, R.layout.frag_row_items, R.id.textView1, titles);
this.context = context;
this.imgArray = img;
this.titlesArray = titles;
this.infoArray = titles;
}[/HIGH]

Fragment Class that instantiate the Custom Adapter Class
[HIGH]class FragmentExample extends ListFragment {

public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

String[] columns = { MediaStore.Video.Media.TITLE,
MediaStore.Video.Media.ARTIST };

Cursor cursor = getActivity().getContentResolver().query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI, columns, null,
null, null);
// how to put put the img of video, title and artist to the adapter class
// from the sdcard and put it in my Custom adapter class
MyCustomAdapter adapter = new MyCustomAdapter(getActivity(), myImage,
myTitle, myInfo);

setListAdapter(adapter);[/HIGH]
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones