I'm having songs ArrayList like this
songs.add(new Songs("Rumour Has It","Adele", "Adele21", R.drawable.adele, 1991, R.drawable.adele21_cover));
songs.add(new Songs("Turning Tables","Adele", "Adele21", R.drawable.adele, 1991, R.drawable.adele21_cover));
songs.add(new Songs("dangerous","M Jackson", "Dangerous", R.drawable.jackson, 1992, R.drawable.dangerous_cover));
I want to get the index of ArrayList row which has the song "Turning Tables" which is now playing so I can play next or previous song
String songName = preferenceConfig.readSongName();
for(Songs s : MainActivity.songs){
boolean resultOfComparison= songName.equals(s.getSong());
if(resultOfComparison){
//how to get the index of this row which contains this song
}
}