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 Intent getGalleryIntent() { Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); return intent; }
From source file:Main.java
public static void openContacts(Activity context, int requestCode) { Uri uri = Uri.parse("content://contacts/people"); context.startActivityForResult(new Intent(Intent.ACTION_PICK, uri), requestCode); }
From source file:Main.java
public static List<String> listAlldir(Context cxt) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Uri uri = intent.getData();/*from ww w. ja va 2 s . c o m*/ List<String> list = new ArrayList<String>(); String[] proj = { MediaStore.Images.Media.DATA }; Cursor cursor = cxt.getContentResolver().query(uri, proj, null, null, null); while (cursor.moveToNext()) { String path = cursor.getString(0); list.add(new File(path).getAbsolutePath()); } return list; }
From source file:Main.java
public static Intent getImageFromGalleryCamera(Context context) { // Determine Uri of camera image to save. File root = new File( Environment.getExternalStorageDirectory() + File.separator + "dianta/camera" + File.separator); root.mkdirs();//from w w w .j a va 2 s. c om String fname = "dianta-" + System.currentTimeMillis() + ".jpg"; File sdImageMainDirectory = new File(root, fname); Uri outputFileUri = Uri.fromFile(sdImageMainDirectory); // camera List<Intent> cameraIntents = new ArrayList<>(); Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); PackageManager lPackageManager = context.getPackageManager(); List<ResolveInfo> listCam = lPackageManager.queryIntentActivities(captureIntent, 0); for (ResolveInfo rInfo : listCam) { String packageName = rInfo.activityInfo.packageName; Intent lIntent = new Intent(captureIntent); lIntent.setComponent(new ComponentName(rInfo.activityInfo.packageName, rInfo.activityInfo.name)); lIntent.setPackage(packageName); //save camera result to external storage lIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); cameraIntents.add(lIntent); } //ugly hacks for camera helper lastCameraImageSaved = outputFileUri; // gallery Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_PICK); Intent chooserIntent = Intent.createChooser(galleryIntent, "Pilih Sumber"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()])); return chooserIntent; }
From source file:com.ae.apps.common.fragments.ContactPickerFragment.java
/** * Start the contact picking process/*from www .jav a 2 s.co m*/ */ public void pickContact() { Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, CONTACT_PICKER_RESULT); }
From source file:Main.java
public static Intent getIntentForAction(int action) { Log.d(TAG, "[AirImagePickerUtils] Entering getIntentForAction"); Intent intent;// www . j av a 2s. c o m switch (action) { case GALLERY_IMAGES_ONLY_ACTION: intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Log.d(TAG, "[AirImagePickerUtils] Exiting getIntentForAction"); return intent; case GALLERY_VIDEOS_ONLY_ACTION: intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("video/*"); Log.d(TAG, "[AirImagePickerUtils] Exiting getIntentForAction"); return intent; case CAMERA_IMAGE_ACTION: Log.d(TAG, "[AirImagePickerUtils] Exiting getIntentForAction"); return new Intent(MediaStore.ACTION_IMAGE_CAPTURE); case CAMERA_VIDEO_ACTION: Log.d(TAG, "[AirImagePickerUtils] Exiting getIntentForAction"); return new Intent(MediaStore.ACTION_VIDEO_CAPTURE); case CROP_ACTION: Log.d(TAG, "[AirImagePickerUtils] Exiting getIntentForAction"); return new Intent("com.android.camera.action.CROP"); default: Log.d(TAG, "[AirImagePickerUtils] Exiting getIntentForAction"); return null; } }
From source file:org.apache.cordova.audiofilepicker.AudioFilePicker.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { this.callbackContext = callbackContext; if (action.equals("selectAudioFile")) { Log.d("customPlugin", " selectAudioFile "); Runnable selectAudioFile = new Runnable() { @Override// w w w.j a va 2s . co m public void run() { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); cordova.setActivityResultCallback(AudioFilePicker.this); cordova.getActivity().startActivityForResult(Intent.createChooser(intent, "Gallery"), 6); } }; this.cordova.getActivity().runOnUiThread(selectAudioFile); return true; } else { return false; } }
From source file:io.hypertrack.sendeta.util.images.EasyImage.java
private static Intent createGalleryIntent() { return new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); }
From source file:com.github.baoti.pioneer.ui.news.NewsActivity.java
public static Intent actionPick(Context context) { return withAction(context, Intent.ACTION_PICK); }
From source file:com.commonsware.android.rotation.frag.RotationFragment.java
public void pickContact(View v) { Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(i, PICK_REQUEST); }