0

I was recently trying to make an app to list the audio files in user's device but I encountered an error that whenever the user tried to change the file name or delete the file it would not be removed from my database

Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection = {MediaStore.Audio.AudioColumns.DATA, MediaStore.Audio.AudioColumns.TITLE};
Cursor c = this.getContentResolver().query(uri, projection, null, null, null);
if (c != null) {
     while (c.moveToNext()) {
          String path = c.getString(0);
          String name = c.getString(1);
          Uri filePath = Uri.parse(path);
          File audioFile = new File(filePath.getPath());
     }
}

If the name of the file is changed still it will show the previous name and path instead of the new one so how to change the data of cursor along with file

I tried running the code in onResume function and clearing the cache but the issue still exists.

0 Answers0