Skip to content

A photo picker that allows users to select photos from their local camera roll on Android.

License

Notifications You must be signed in to change notification settings

dbotha/Android-Photo-Picker

Repository files navigation

Android Photo Picker

A image picker providing a simple UI for a user to pick photos from their device external storage / camera roll / photo gallery.

Video Preview

Preview

Requirements

  • Android API Level 14 - Android 4.0 (ICE_CREAM_SANDWICH)

Installation

Android Studio / Gradle

We publish builds of our library to the Maven central repository as an .aar file. This file contains all of the classes, resources, and configurations that you'll need to use the library. To install the library inside Android Studio, you can simply declare it as dependecy in your build.gradle file.

dependencies {
    compile 'ly.kite:photo-picker:1.+'
}

Once you've updated your build.gradle file, you can force Android Studio to sync with your new configuration by selecting Tools -> Android -> Sync Project with Gradle Files

This should download the aar dependency at which point you'll have access to the API calls. If it cannot find the dependency, you should make sure you've specified mavenCentral() as a repository in your build.gradle

Usage

To launch the Photo Picker:

// Somewhere in an Activity:

import ly.kite.photopicker.Photo;
import ly.kite.photopicker.PhotoPicker;

static final int REQUEST_CODE_PHOTO_PICKER = 1;

PhotoPicker.startPhotoPickerForResult(this, REQUEST_CODE_PHOTO_PICKER);

Implement onActivityResult:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE_PHOTO_PICKER) {
            if (resultCode == Activity.RESULT_OK) {
                Photo[] photos = PhotoPicker.getResultPhotos(data);
                Toast.makeText(this, "User selected " + photos.length + " photos", Toast.LENGTH_SHORT).show();
            } else if (resultCode == Activity.RESULT_CANCELED) {
                Toast.makeText(this, "Photo Picking Cancelled", Toast.LENGTH_SHORT).show();
            } else {
                Log.i("dbotha", "Unknown result code: " + resultCode);
            }
        }
}
    

Sample Apps

The project is bundled with a Sample App to highlight the libraries usage.

License

This project is available under the MIT license. See the LICENSE file for more info.

About

A photo picker that allows users to select photos from their local camera roll on Android.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages