android-mediascanner

update android image gallery with newly created bitmap

故事扮演 提交于 2019-12-18 04:24:11
问题 I'm trying to save an image file to external storage. I can save the picture to the sdcard but it doesn't show up in Androids gallery application. I've tried this approach: File path = Environment.getExternalStorageDirectory(); File f = new File(path + "/mydirectory/" + imageName + "_" + System.currentTimeMillis() + ".jpg"); FileOutputStream fos = new FileOutputStream(f); f.mkdirs(); b.compress(CompressFormat.JPEG, 100, fos); fos.close(); Uri contentUri = Uri.fromFile(f); Intent

how to get frames of video file in android

纵然是瞬间 提交于 2019-12-17 17:14:59
问题 I want to get the frames of a video file to show in a gallery view in android. and how to edit frames, for example Select frame sections use selected sections delete selected sections copy selected sections cut selected sections paste into the head paste into the tail 回答1: You can use the MediaMetadataRetriever class. It has getFrameAt() method wherein you can specify the time of the frame that you want to get. For details refer to MediaMetadataRetriever 回答2: Actually, MediaMetadataRetriever

how to get frames of video file in android

被刻印的时光 ゝ 提交于 2019-12-17 17:13:19
问题 I want to get the frames of a video file to show in a gallery view in android. and how to edit frames, for example Select frame sections use selected sections delete selected sections copy selected sections cut selected sections paste into the head paste into the tail 回答1: You can use the MediaMetadataRetriever class. It has getFrameAt() method wherein you can specify the time of the frame that you want to get. For details refer to MediaMetadataRetriever 回答2: Actually, MediaMetadataRetriever

How to listen new photos in android?

Deadly 提交于 2019-12-13 11:48:31
问题 I need to listen to new images that comes from any source like downloading images, capture new images, other apps download images..etc Is there any listener that will trigger event whenever new photos is added to gallery? I have been searching for two days. I could not get anything solid. I read about FileObserver , will that help? 回答1: new photos arrives to gallery means it has been added to the MediaStore . First of all, FileOberver is a memory-killer approach. Consider a high volume of

Refresh MediaStore for Images & Videos

瘦欲@ 提交于 2019-12-13 07:51:16
问题 I moving and deleting lots of images and videos as per my requirement and now i am scan media by using Intent scanFileIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri); sendBroadcast(scanFileIntent); all working fine but sometime freeze the screen, i think some issue in MediaScanner. And my second quetion is how to scan all media Store rether than scan perticuler File. Thanks in Advance!! 回答1: You should try this solution for amove and delete the image. Pass file directory path

Trigger mediascanner for older and new android devices (below and above kitkat)

守給你的承諾、 提交于 2019-12-12 06:03:21
问题 How can I put Mediascanner code here? I need to show images on gallery. Tried so many solutions, but nothing worked. An example with the given code will be helpful: public void SaveImage(Bitmap bitmap) { final File myDir = new File( Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), pref.getGalleryName()); myDir.mkdirs(); // fix myDir.setExecutable(true); myDir.setReadable(true); myDir.setWritable(true); Random generator = new Random(); int n = 100000; n =

Save and Insert video to gallery on Android 10

天大地大妈咪最大 提交于 2019-12-11 20:14:11
问题 I'm trying to save a video to the gallery,the following code works well an all Android versions except the Android Q : private void getPath() { String videoFileName = "video_" + System.currentTimeMillis() + ".mp4"; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ContentResolver resolver = getContentResolver(); ContentValues contentValues = new ContentValues(); contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, videoFileName); contentValues.put(MediaStore.MediaColumns.MIME_TYPE,

After saved image can't see it in Gallery android [duplicate]

若如初见. 提交于 2019-12-11 14:16:28
问题 This question already has answers here : How to save image in android gallery (6 answers) Closed 5 years ago . I am saving Image from res/drawable to Gallery using InputStream and OutputStream . It works fine and save image. But issue is that It does not update Image in Gallery. If I check folder using ES File Explorer then I can see image there. I also checked ddms , It also update image there as soon as write code executes. It works fine if I save Server Image. How to prevent this issue ? I

I can't save my bitmap to the Gallery in Android?

时间秒杀一切 提交于 2019-12-11 07:16:19
问题 I'm trying to save my edited image into Gallery from where user can access it. I have used "Add the photo to the Gallery" from reference: https://developer.android.com/training/camera/photobasics.html Here is my Code: String mCurrentPhotoPath; public void startSave() { FileOutputStream fileOutputStream = null; File new_file = null; try { new_file = createImageFile(); fileOutputStream = new FileOutputStream(new_file); imageView.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap

Android Thumbnails inside MediaStore isn't getting refreshed after calling MediaScannerConnection.scanFile

╄→гoц情女王★ 提交于 2019-12-11 03:13:51
问题 I'm trying to build a Gallery-like app which will perform the following functions on External storage: List all the folder that has images inside it List all the images that available to the public (will not probe the files inside Android/data ) So far I can list all the images, and folders that have images. However, I later find that these images and folders are not the newest ones: they are not getting refreshed after I put some pictures (say I simply do some screenshots or download some