pick Photo - Android android.hardware

Android examples for android.hardware:Photo

Description

pick Photo

Demo Code

import android.app.Activity;
import android.content.Intent;

public class Main {

  public static final int REQUEST_CODE_PICK_PHOTO = REQUEST_CODE_TAKE_PHOTO + 3;

  public static void pickPhoto(Activity activity) {
    Intent intent = pickPhotoIntent();/*w  w w .  j ava2  s  .  c  om*/
    activity.startActivityForResult(intent, REQUEST_CODE_PICK_PHOTO);
  }

  public static void pickPhoto(android.support.v4.app.Fragment fragment) {
    Intent intent = pickPhotoIntent();
    fragment.startActivityForResult(intent, REQUEST_CODE_PICK_PHOTO);
  }

  private static Intent pickPhotoIntent() {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    return intent;
  }

}

Related Tutorials