I am working on a music app. I have been able to get all audio files on my device external storage and add them to a recycler view, but there are some corrupt files on the device. I want to add only the non-corrupt files and filter out the corrupt ones. I have tried a couple of ways, but none seems to work.
- I tried usin' the mediaPlayer.prepare() method to prepare the audio file and then catch an IllegalStateException, but it was in vain.
- I also tried using FileOutputStream to read the audio file and catch an exception, still no positive result.
- I tried usin' the Iterator class to iterate through the files then with Uri.parse(song.getPath) chek if it's null and if null remove from the list, still didn't work.
PLEASE HELP...