Coder Social home page Coder Social logo

Comments (4)

Logan676 avatar Logan676 commented on May 27, 2024

Now I know how to convert. There is a scan method

    private void scan(Uri uri) {
        if (!uri.toString().contains(PHOTO_PICKER_AUTHORITIES)) {
            return;
        }
        String path = uri.getPath();
        String[] split = path.split("/");

        String filePath = FileOperationUtils.getMatissePhotoPath() + File.separatorChar + split[split.length - 1];
        if (TextUtils.isEmpty(filePath)) {
            return;
        }

        Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);

        File f = new File(filePath);
        Uri contentUri = Uri.fromFile(f);
        mediaScanIntent.setData(contentUri);
        mActivity.sendBroadcast(mediaScanIntent);
    }

this is exactly the path I need.

String filePath = FileOperationUtils.getMatissePhotoPath() + File.separatorChar + split[split.length - 1];

Sorry for the noise.

from matisse.

woniu0936 avatar woniu0936 commented on May 27, 2024

@Logan676 hope you show the code for this method getMatissePhotoPath,please!

from matisse.

Logan676 avatar Logan676 commented on May 27, 2024

@woniu0936 the code like below,

     public static String getMatissePhotoPath() {
        File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        return file.getAbsolutePath();
    }

from matisse.

Logan676 avatar Logan676 commented on May 27, 2024

797948d#diff-167d5c846632dd829a5cd66b5bf5a6f6R110

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.