Skip to content

Latest commit

 

History

History
76 lines (62 loc) · 2 KB

README.md

File metadata and controls

76 lines (62 loc) · 2 KB

KutuPicker

KutuPicker is a android image picker library using Camera & Gallery.

Usages

  1. Add in project level build.gradle
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://jitpack.io' }  // This Line
    }
}
  1. Add in module level build.gradle
dependencies {
	implementation 'ninja.sakib:KutuPicker:1.0.1'
}
  1. Start Image Picker
  • Using Gallery
Intent i = new Intent(getApplicationContext(), GalleryPickerActivity.class);
i.putExtra(CodeUtil.MAX_SELECTION, 5);
i.putExtra(CodeUtil.MIN_SELECTION, 1);
startActivityForResult(i, CodeUtil.IMAGE_SELECTION_REQUEST_CODE);
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == CodeUtil.IMAGE_SELECTION_DONE) {
        ArrayList<String> selectedImages = data.getStringArrayListExtra(CodeUtil.SELECTED_IMAGES_KEY);
        for (String image : selectedImages) {
            Log.d("Selected", image);
        }
    }
}
  • Using Camera
Intent i = new Intent(getApplicationContext(), CameraPickerActivity.class);
i.putExtra(CodeUtil.MAX_SELECTION, 5);
i.putExtra(CodeUtil.MIN_SELECTION, 1);
startActivityForResult(i, CodeUtil.IMAGE_SELECTION_REQUEST_CODE);
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == CodeUtil.IMAGE_SELECTION_DONE) {
        ArrayList<String> selectedImages = data.getStringArrayListExtra(CodeUtil.SELECTED_IMAGES_KEY);
        for (String image : selectedImages) {
            Log.d("Selected", image);
        }
    }
}

License

Copyright © Sakib Sami

Distributed under MIT license