public void searchSong(String songToSearch){
Toast.makeText(getApplicationContext(), songToSearch, Toast.LENGTH_SHORT).show();
boolean found = false;
for(int i = 0; i < fileArray.length; i++ ){
String value = fileArray[i].toLowerCase().replace(".mp3","");
if (songToSearch.toLowerCase().matches(value) && !found) {
Toast.makeText(getApplicationContext(), value, Toast.LENGTH_SHORT).show();
found = true;
} else {
found = false;
}
if(found){
Toast.makeText(getApplicationContext(), "Found", Toast.LENGTH_SHORT).show();
}
}
}
I want to use the code to check if the songToSearch is a part of any string inside the fileArray Example lets say that fileArray[2] is equal to "Hello world" and the songToSearch is equal to "world" I would like to make the boolean found true... However this is not happening... the boolean never changes