Coder Social home page Coder Social logo

相册刷新问题 about matisse HOT 2 OPEN

zhihu avatar zhihu commented on May 27, 2024
相册刷新问题

from matisse.

Comments (2)

gejiaheng avatar gejiaheng commented on May 27, 2024

@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.

from matisse.

ZGaoFei avatar ZGaoFei commented on May 27, 2024

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

from matisse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.