Giter VIP home page Giter VIP logo

Comments (3)

m1d1 avatar m1d1 commented on September 28, 2024

@TheCorpAdmin
Based on the Sample from @ArthurHub, this fix works on Nexus 5 | Android 6.0.1

Add permisson to the AndroidManifest.xml and replace the getPickImageResultUri method.

<uses-permission android:name="android.permission.CAMERA"/>

 /**
     * Get the URI of the selected image from {@link #getPickImageChooserIntent()}.<br/>
     * Will return the correct URI for camera and gallery image.
     *
     * @param data the returned data of the activity result
     */
    public Uri getPickImageResultUri(Intent data) {
        boolean isCamera = true;
        if (android.os.Build.VERSION.SDK_INT >= 23) {
            isCamera = (data != null && data.getClipData() != null) ? false : true;
        } else {
            if (data != null) {
                String action = data.getAction();
                isCamera = action != null && action.equals(MediaStore.ACTION_IMAGE_CAPTURE);
            }
        }
        return isCamera ? getCaptureImageOutputUri() : data.getData();
    }

from android-image-cropper.

ArthurHub avatar ArthurHub commented on September 28, 2024

Awesome, I will update the code snippets.
Thank you.

from android-image-cropper.

ArthurHub avatar ArthurHub commented on September 28, 2024

Well... I hate this stuff 😠
Updated my Moto X to 6.0 but I don't have this issue with my default camera, emulator also works fine#$%@#$
Changed the code to the one suggested by @m1d1 but then image from Dropbox stopped working because data.getClipData() is null in its case...
So... as far as I know adding data.getData() != null should be enough, please let me know if it doesn't works for Nexus.

public Uri getPickImageResultUri(Intent data) {
    boolean isCamera = true;
    if (data != null && data.getData() != null) {
        String action = data.getAction();
        isCamera = action != null && action.equals(MediaStore.ACTION_IMAGE_CAPTURE);
    }
    return isCamera ? getCaptureImageOutputUri() : data.getData();
}

from android-image-cropper.

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.