As you can see, I'm new here (but not new to programming). I'm working on my first android camera app, and I cant get my video files to show up in the gallery. I understand that I need to inform the system of my new file's Content Values, but nothing I try is working.
Strangely this works just fine for images:
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, imgFile.getAbsolutePath());
getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Yet this does not always make videos visible in the gallery app:
ContentValues values = new ContentValues();
values.put(MediaStore.Video.Media.DATA, vidFile.getAbsolutePath());
getContentResolver().insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values);
I assure you it is a valid video file, and sometimes the above code works. I cannot find a pattern for when it will work and when not, though.
I have also tried a few other variations to getContentResolver().insert. In fact, If I tell it my video file is an image, it always updates the gallery with a nonviewable image that is my video.
Thanks much in advance for any help!