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:com.shafiq.mytwittle.view.BaseLaneActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (composeReleaseFocus(false) == true) { return true; }//from w ww. j ava 2 s . c o m break; case R.id.action_gallery: { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, Constant.REQUEST_CODE_IMAGE_PICKER); // startActivityForResult(new Intent(Intent.ACTION_PICK, // android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), // Constant.REQUEST_CODE_IMAGE_PICKER); return true; } case R.id.action_camera: { if (Util.isIntentAvailable(this, android.provider.MediaStore.ACTION_IMAGE_CAPTURE)) { Uri tmpUri = Uri.fromFile(getFixedTempFile(BaseLaneActivity.this)); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, tmpUri); startActivityForResult(intent, Constant.REQUEST_CODE_CAMERA); } return true; } /* * case R.id.action_locate: Toast.makeText(getApplicationContext(), * getString(R.string.functionality_not_implemented), * Constant.DEFAULT_TOAST_DISPLAY_TIME).show(); break; */ default: { BaseLaneFragment fragment = mLaneFragmentHashMap.get(getCurrentLaneIndex()); if (fragment != null) { return fragment.onOptionsItemSelected(item); } } } return false; }
From source file:com.tweetlanes.android.core.view.BaseLaneActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int i = item.getItemId(); if (i == android.R.id.home) { if (composeReleaseFocus(false)) { clearCompose();//from ww w . j a v a 2 s .c o m return true; } } else if (i == R.id.action_gallery) { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, Constant.REQUEST_CODE_IMAGE_PICKER); return true; } else if (i == R.id.action_camera) { if (Util.isIntentAvailable(this, MediaStore.ACTION_IMAGE_CAPTURE)) { Uri tmpUri = Uri.fromFile(getFixedTempFile(BaseLaneActivity.this)); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, tmpUri); startActivityForResult(intent, Constant.REQUEST_CODE_CAMERA); } return true; /* * case R.id.action_locate: Toast.makeText(getApplicationContext(), * getString(R.string.functionality_not_implemented), * Constant.DEFAULT_TOAST_DISPLAY_TIME).show(); break; */ } else { BaseLaneFragment fragment = mLaneFragmentHashMap.get(getCurrentLaneIndex()); if (fragment != null) { return fragment.onOptionsItemSelected(item); } } return false; }
From source file:de.vanita5.twittnuker.activity.support.ComposeActivity.java
private void pickImage() { final Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); try {/*w ww . j a v a 2 s .com*/ startActivityForResult(intent, REQUEST_PICK_IMAGE); } catch (final ActivityNotFoundException e) { showErrorMessage(this, null, e, false); } }
From source file:org.kontalk.ui.AbstractComposeFragment.java
/** Starts activity for a vCard attachment from a contact. */ void selectContactAttachment() { try {/*w w w. ja v a 2s . c om*/ Intent i = SystemUtils.externalIntent(Intent.ACTION_PICK, Contacts.CONTENT_URI); startActivityForResult(i, SELECT_ATTACHMENT_CONTACT); } catch (ActivityNotFoundException e) { // no contacts app found (crap device eh?) Toast.makeText(getActivity(), R.string.err_no_contacts_app, Toast.LENGTH_LONG).show(); } }
From source file:com.ranglerz.tlc.tlc.com.ranglerz.tlc.tlc.Insurance.TlcInsurance.java
private void galleryIntent() { if (btnClicked == licenseButton) { Log.d(TAG, "galleryIntent: License Button"); Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_PICK);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_LICENSE); // Intent gallaryIntent = new Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI); // startActivityForResult(gallaryIntent, SELECT_FILE_LICENSE); } else if (btnClicked == ssCardButton) { Log.d(TAG, "galleryIntent: SSCARD Button"); Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_PICK);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_SSCARD); } else if (btnClicked == baseLetterButton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_BASELETTER); } else if (btnClicked == utilityBillsbutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_UTILITYBILLS); } else if (btnClicked == mvTitlebutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_MVTITLE); } else if (btnClicked == sixhrdrivingbutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_sixhrdriving); } else if (btnClicked == shlPermitbutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_SHLPERMIT); } else if (btnClicked == shlpermitreceiptbutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_SHLRECEIPT); } else if (btnClicked == ispermitownedbutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_ISPERMITOWNED); } else if (btnClicked == certificatebutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_certificate); } else if (btnClicked == fillingbutton) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_filling); }// w ww . ja va 2 s . c o m }
From source file:org.mariotaku.twidere.fragment.UserProfileFragment.java
private void pickImage() { final Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, REQUEST_PICK_IMAGE); }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static void activateTab(Activity a, int id) { Intent intent = new Intent(Intent.ACTION_PICK); switch (id) { case R.id.artisttab: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/artistalbum"); break;/*w ww.java2 s . com*/ case R.id.albumtab: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/album"); break; case R.id.songtab: intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); break; case R.id.playlisttab: intent.setDataAndType(Uri.EMPTY, MediaStore.Audio.Playlists.CONTENT_TYPE); break; case R.id.nowplaying: // intent = new Intent(a, MediaPlaybackActivity.class); // a.startActivity(intent); // fall through and return default: return; } intent.putExtra("withtabs", true); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); a.startActivity(intent); a.finish(); a.overridePendingTransition(0, 0); }
From source file:jahirfiquitiva.iconshowcase.activities.ShowcaseActivity.java
private void getAction() { String action;/*from w ww . java2 s. com*/ try { action = getIntent().getAction(); } catch (Exception e) { action = "action"; } try { switch (action) { case adw_action: case turbo_action: case nova_action: case Intent.ACTION_PICK: case Intent.ACTION_GET_CONTENT: iconsPicker = true; wallsPicker = false; break; case Intent.ACTION_SET_WALLPAPER: iconsPicker = false; wallsPicker = true; break; default: iconsPicker = false; wallsPicker = false; break; } } catch (ActivityNotFoundException | NullPointerException e) { iconsPicker = false; wallsPicker = false; } }
From source file:com.google.android.apps.paco.ExperimentExecutorCustomRendering.java
private void startGalleryPicker() { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, RESULT_GALLERY); }