Skip to content
Edgar Asatryan edited this page Oct 15, 2016 · 4 revisions

Image Chooser

  • For choosing an image - Single image
ImageChooserManager imageChooserManager = new ImageChooserManager(this, ChooserType.REQUEST_PICK_PICTURE);
imageChooserManager.setImageChooserListener(new ImageChooserListener() {
         @Override
         public void onImageChosen(final ChosenImage image) {
               // Do something
         }
 
         @Override
         public void onError(final String reason) {
               // Do something
         }

         @Override
         public void onImagesChosen(final ChosenImages images) {
               // Do something
         }
});

For triggering multiple selection:

    Bundle extras = new Bundle();
    extras.putBoolean(Intent.EXTRA_ALLOW_MULTIPLE, true);
    imageChooserManager.setExtras(extras);
  • For taking a snap using the device's camera
ImageChooserManager imageChooserManager = new ImageChooserManager(this, ChooserType.REQUEST_CAPTURE_PICTURE);
imageChooserManager.setImageChooserListener(new ImageChooserListener() {
         @Override
         public void onImageChosen(final ChosenImage image) {
               // Do something
         }
 
         @Override
         public void onError(final String reason) {
               // Do something
         }

         @Override
         public void onImagesChosen(final ChosenImages images) {
               // Do nothing
         }
});

Video Chooser

  • For choosing a video - Single video
VideoChooserManager videoChooserManager = new VideoChooserManager(this, ChooserType.REQUEST_PICK_VIDEO);
videoChooserManager.setVideoChooserListener(new VideoChooserListener() {
         @Override
         public void onVideoChosen(final ChosenVideo video) {
               // Do something
         }
 
         @Override
         public void onError(final String reason) {
               // Do something
         }

         @Override
         public void onVideosChosen(final ChosenVideos videos) {
               // Do something
         }
});

For triggering multiple selection:

    Bundle extras = new Bundle();
    extras.putBoolean(Intent.EXTRA_ALLOW_MULTIPLE, true);
    videoChooserManager.setExtras(extras);
  • For taking a video using the device's camera
VideoChooserManager videoChooserManager = new VideoChooserManager(this, ChooserType.REQUEST_CAPTURE_VIDEO);
videoChooserManager.setVideoChooserListener(new VideoChooserListener() {
         @Override
         public void onVideoChosen(final ChosenVideo video) {
               // Do something
         }
 
         @Override
         public void onError(final String reason) {
               // Do something
         }

         @Override
         public void onVideosChosen(final ChosenVideos videos) {
               // Do nothing
         }
});
Clone this wiki locally