How I can search in the ListView

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How I can search in the ListView



Hi I am making a music player app and I would to search for each song on the listview. How can I made it??



get All Songs function:


ArrayList<SongInfo> SongsList = new ArrayList<SongInfo>();

Cursor cursor;

//local
public ArrayList<SongInfo> getAllSongs()
Uri allsongsuri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;

String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";

cursor = getContentResolver().query(allsongsuri, null, selection, null, null);

if (cursor != null)
if (cursor.moveToFirst())
do

String song_name = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE));
String fullpath = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));
String album_name = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM));
String artist_name = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
duration = Integer.parseInt(cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DURATION)));
SongsList.add(new SongInfo(fullpath, song_name, album_name, artist_name, convertDuration(duration)));

while (cursor.moveToNext());


cursor.close();



return SongsList;





Welcome to Stackoverflow. Looks like an awful lot of code with little problem description. Please edit your question, to extent and clarify your problem description and if possible try to reduce the amount of code such that only the nonworking code is left (called minimal code example). That might help you finding answers. For guidance please check the how to ask page and how to create a minimal example. And take the tour!
– 5th
Aug 10 at 15:09










By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard