Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Image Crop in Android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 321
    Comment on it

    Image cropping in Android, there is a support in some devices by default for cropping image but its not reliable, so here is some code to get rid of this problem.

    Step 1. Declare crop activity in your manifest like this :-

    <activity android:name="com.soundcloud.android.crop.CropImageActivity" />

    Step 2. Use Crop action like this :-

    Crop.of(inputUri, outputUri).asSquare().start(activity)

     

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent result) {
        if (requestCode == Crop.REQUEST_CROP && resultCode == RESULT_OK) {
            doSomethingWithCroppedImage(outputUri);
        }
    }

    Step 3. Get the output Uri and use it on image view to show.

    Step 4. Declare dependency in gradle.

    compile 'com.soundcloud.android:android-crop:1.0.1@aar'

    Helpful link :- https://github.com/jdamcd/android-crop

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: