1

Wrote the program, added the ability to rename the video file, only the trouble is that the file that is stored in the phone's memory is renamed without problems, but the file that is on the memory card(sd card\ external strage) can not be renamed.

Requests such as Manifest.permission.WRITE_EXTERNAL_STORAGE do not change the situation at all. Video on the sd card does not renamed at all. Can someone tell me how you can solve this problem. Someone say that I need a special request.

ContentValues values = new ContentValues();                                                    values.put(MediaStore.Video.Media.DISPLAY_NAME, newname);                                                   values.put(MediaStore.Video.Media.DATA, from.getParent()+"/"+newname);
ContentResolver contentResolver = context.getContentResolver();
Uri base = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
contentResolver.update(base, values,MediaStore.Video.Media._ID + "=?",new String[]{list.get(position).getID()});
list.get(position).setNewName(newname, from.getParent()+"/"+newname);
notifyDataSetChanged();

This code rename only files that stored on internal storage, but not rename files that stored on sdcard(external storage).

Simon
  • 11
  • 2
  • Check this :- [http://stackoverflow.com/questions/2896733/how-to-rename-a-file-on-sdcard-with-android-application](http://stackoverflow.com/questions/2896733/how-to-rename-a-file-on-sdcard-with-android-application) – Varun Jain Mar 09 '17 at 10:43
  • updated question, look pls. – Simon Mar 09 '17 at 10:47

0 Answers0