Adding video to Android Content Manager -
can see, i'm new here (but not new programming). i'm working on first android camera app, , cant video files show in gallery. understand need inform system of new file's content values, nothing try working.
strangely works fine images:
contentvalues values = new contentvalues(); values.put(mediastore.images.media.data, imgfile.getabsolutepath()); getcontentresolver().insert(mediastore.images.media.external_content_uri, values);
yet not make videos visible in 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 valid video file, , above code works. cannot find pattern when work , when not, though.
have tried few other variations getcontentresolver().insert. in fact, if tell video file image, always updates gallery nonviewable image video.
in advance help!
well has been ordeal, found work-around. new solution might better trying do. depends on overheads of various methods suppose.
as stated pascal here, can update content provider broadcasting proper intent:
sendbroadcast(new intent(intent.action_media_scanner_scan_file, uri.fromfile(imageaddedordeleted)));
this makes videos visible gallery app every time (thank god, resort writing own built in viewer) i'm still curious why method works images not video, in case knows.
Comments
Post a Comment