List of usage examples for android.content Intent ACTION_PICK
String ACTION_PICK
To view the source code for android.content Intent ACTION_PICK.
Click Source Link
From source file:Main.java
public static void pickImageFromPhotoForFragment(Fragment fragment, int requestCode) { Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); fragment.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void chooseImg(Activity activity) { Intent pickIntent = new Intent(Intent.ACTION_PICK, null); pickIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); activity.startActivityForResult(pickIntent, PHOTO_REQUEST_GALLERY); }
From source file:Main.java
public static void pickImage(Context mContext, int CAMERA_PICK_IMAGE_REQUEST_CODE) { Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); ((Activity) mContext).startActivityForResult(intent, CAMERA_PICK_IMAGE_REQUEST_CODE); }
From source file:Main.java
public static void showPhoneContact(Activity activity, int returnCode) { if (activity == null) return;/*from ww w .j a v a 2 s. co m*/ Intent intent = new Intent(Intent.ACTION_PICK); intent.setType(ContactsContract.Contacts.CONTENT_TYPE); activity.startActivityForResult(intent, returnCode); }
From source file:Main.java
public static void pickImageFromAlbum2(final Activity activity) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI); activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM); }
From source file:Main.java
public static Intent buildVideoIntent(Context context, Uri uri) { String title = "Choose photo"; //Build galleryIntent Intent galleryIntent = new Intent(Intent.ACTION_PICK); galleryIntent.setType("video/*"); //Create chooser Intent chooser = Intent.createChooser(galleryIntent, title); Intent cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri); Intent[] extraIntents = { cameraIntent }; chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); return chooser; }
From source file:Main.java
public static void openAlbum(Activity activity, int requestCode) { Intent intent;/*from w w w. j a v a2 s . co m*/ if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); } else { intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void choiceAvatarFromGalleryWithCrop(Activity context) { Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); //intent.setAction(Intent.ACTION_GET_CONTENT); context.startActivityForResult(intent, SELECT_IMAGE_GALLERY_REQUEST_CODE); //if (Build.VERSION.SDK_INT < 19) { // Intent intentPikc = new Intent(); // intentPikc.setType("image/*"); // intentPikc.setAction(Intent.ACTION_GET_CONTENT); // context.startActivityForResult(intentPikc, SELECT_IMAGE_GALLERY_REQUEST_CODE); // } else { // Intent intentKitKat = new Intent(Intent.ACTION_GET_CONTENT); // intentKitKat.setType("image/*"); // context.startActivityForResult(intentKitKat, SELECT_KITKAT_IMAGE_GALLERY_REQUEST_CODE); // }/* w w w . ja v a 2 s . co m*/ // Intent intent = new Intent(); // intent.setType("image/*"); // Intent intent = new Intent( // Intent.ACTION_GET_CONTENT, // MediaStore.Images.Media.INTERNAL_CONTENT_URI); // intent.setType("image/*"); //// Intent intent = new Intent(Intent.ACTION_PICK, //// android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); //// intent.setAction(Intent.ACTION_GET_CONTENT); // context.startActivityForResult(intent, SELECT_IMAGE_GALLERY_REQUEST_CODE); // Intent intent = new Intent(); // intent.setType("image/*"); // intent.setAction(Intent.ACTION_GET_CONTENT); // context.startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_IMAGE_GALLERY_REQUEST_CODE); }
From source file:Main.java
public static Intent pickImage() { final Intent intent = new Intent(Intent.ACTION_PICK); intent.setType(MediaStore.Images.Media.CONTENT_TYPE); return intent; }
From source file:Main.java
public static Intent pickContact(String with) { final Intent intent = new Intent(Intent.ACTION_PICK, Uri.parse("content://com.android.contacts/contacts")); if (!TextUtils.isEmpty(with)) { intent.setType(with);/*w ww .ja va 2 s . c om*/ } return intent; }