Navigation Menu

Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
biokys committed Jun 5, 2013
1 parent 6e4abb7 commit 47b7029
Showing 1 changed file with 59 additions and 2 deletions.
61 changes: 59 additions & 2 deletions README.md
@@ -1,6 +1,63 @@
cropimage
Cropimage
=========

Replacement for deprecated official Android crop image function
- Replacement for deprecated official Android crop image function
- > 2.2 API
- Easy to integrate to your app.
- Enjoy ;-)


Call this method to run CropImage activity
```java
private void runCropImage() {

// create explicit intent
Intent intent = new Intent(this, CropImage.class);

// tell CropImage activity to look for image to crop
String filePath = ...;
intent.putExtra(CropImage.IMAGE_PATH, filePath);

// allow CropImage activity to rescale image
intent.putExtra(CropImage.SCALE, true);

// if the aspect ratio is fixed to ratio 3/2
intent.putExtra(CropImage.ASPECT_X, 3);
intent.putExtra(CropImage.ASPECT_Y, 2);

// start activity CropImage with certain request code and listen
// for result
startActivityForResult(intent, REQUEST_CODE_CROP_IMAGE);
}
```

Waiting for result
```java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode != RESULT_OK) {

return;
}

switch (requestCode) {

case REQUEST_CODE_CROP_IMAGE:

String path = data.getStringExtra(CropImage.IMAGE_PATH);

// if nothing received
if (path == null) {

return;
}

// cropped bitmap
Bitmap bitmap = BitmapFactory.decodeFile(mFileTemp.getPath());

break;
}
super.onActivityResult(requestCode, resultCode, data);
}
```

0 comments on commit 47b7029

Please sign in to comment.