image-intent-handler

Additional

Language
Java
Version
N/A
Created
Jul 14, 2015
Updated
Apr 18, 2017 (Retired)
Owner
Himanshu Soni (himanshu-soni)
Contributors
Tobias Preuss (johnjohndoe)
Himanshu Soni (himanshu-soni)
AymanDF
3
Activity
Badge
Generate
Download
Source code
APK file

Promotion

Deprecated and not maintained now.

This library is deprecated now. I am working on a new library which will be have more features and new api support.

image-intent-handler

Easiest way to handle image via camera and gallery intent.

####Features:

  • Resize Image in specific size and folder
  • Take care of OutOfMemoryException
  • Take care of image rotation while camera capture

####Installation:

compile 'me.himanshusoni.iih:iih-library:0.9.2'

####Sample Use:

  1. Create an ImagePair
ImageIntentHandler.ImagePair mImagePair;
  1. Fire intent:
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File f = ImageUtils.createImageFile(ImageUtils.getPackageName(HomeActivity.this));
if ((f != null) && f.exists()) {
  mImagePair = new ImageIntentHandler.ImagePair(mImageView, f.getAbsolutePath());
  takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
  startActivityForResult(takePictureIntent, ImageIntentHandler.REQUEST_CAPTURE);
} else {
  Toast.makeText(HomeActivity.this, "Storage Error", Toast.LENGTH_LONG).show();
}

OR

mImagePair = new ImageIntentHandler.ImagePair(mImageView, null);
Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, ImageIntentHandler.REQUEST_GALLERY);
  1. Tell ImageIntentHandler to handle result:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  ImageIntentHandler intentHandler =
          new ImageIntentHandler(HomeActivity.this, mImagePair)
            .folder("IIH Sample")
            .sizeDp(200);
  intentHandler.handleIntent(requestCode, resultCode, data);
}

================== developed to make programming easy.

by Himanshu Soni (himanshusoni.me@gmail.com)