Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

相册刷新问题 #43

Open
ZGaoFei opened this issue May 9, 2017 · 2 comments
Open

相册刷新问题 #43

ZGaoFei opened this issue May 9, 2017 · 2 comments

Comments

@ZGaoFei
Copy link

ZGaoFei commented May 9, 2017

我设置完capture和captureStrategy后,拍照完成后可以获取图片uri,但是我再次点击进入,刚才拍摄的照片并没有显示出来,我退出到桌面后,后台杀掉应用再进入,刚才拍摄的照片才出现,问这时什么原因造成的,如何解决???

@gejiaheng
Copy link
Contributor

@ZGaoFei
I've noticed this problem.

Quote from developer training:

Add the Photo to a Gallery
When you create a photo through an intent, you should know where your image is located, because you said where to save it in the first place. For everyone else, perhaps the easiest way to make your photo accessible is to make it accessible from the system's Media Provider.

Note: If you saved your photo to the directory provided by getExternalFilesDir(), the media scanner cannot access the files because they are private to your app.

The following example method demonstrates how to invoke the system's media scanner to add your photo to the Media Provider's database, making it available in the Android Gallery application and to other apps.

private void galleryAddPic() {
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
File f = new File(mCurrentPhotoPath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
this.sendBroadcast(mediaScanIntent);
}

Matisse doesn't send this broadcast for now.

And I also encountered a Loader mechanism which I was not sure why:
AlbumLoader and AlbumMediaLoader would load data multiple times on some phones which caused the media list to flash. So as a dirty fix, I overrode onContentChanged().

Anyway, I'll see if we can fix this.

@ZGaoFei
Copy link
Author

ZGaoFei commented May 11, 2017

谢谢及时回复……
是的,通过发送广播的确可以解决这个问题,当然我们也知道图片保存的位置,我们也是这样做的。
对于最后的“AlbumLoader and AlbumMediaLoader would load data multiple times on some phones which caused the media list to flash. ”暂时还没有遇到,我会注意这点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants