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.moinut.picrop.PiCrop.java
public void get(int type, int aspectX, int aspectY, int outputX, int outputY, Uri saveUri, OnCropListener listener) {//from www .ja v a 2s. co m this.mListener = listener; this.picUri = saveUri; Log.i(TAG, "Start getting the picture."); // Get crop intent cropIntent = new CropIntent.Builder().setAspectX(aspectX).setAspectY(aspectY).setOutputX(outputX) .setOutputY(outputY).setSaveUri(saveUri); switch (type) { case FROM_ALBUM: Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(picUri, "image/*"); mContext.startAlbum(intent); break; case FROM_CAMERA: break; } }
From source file:com.crust87.videotrackviewsample.MainActivity.java
@Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Intent lIntent = new Intent(Intent.ACTION_PICK); lIntent.setType("video/*"); lIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(lIntent, ACTIVITY_REQUEST_VIDEO); } else {/* w w w. j a v a2 s.c o m*/ Toast.makeText(mActivity, "APPLICATION NEEDS PERMISSION!", Toast.LENGTH_LONG).show(); } } } }
From source file:com.allen.mediautil.ImageTakerHelper.java
/** * ? onActivityResult()?/* ww w. j a v a2 s . c o m*/ */ public static void openAlbum(Activity activity) { Intent intentAlbum = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intentAlbum.setType("image/*"); activity.startActivityForResult(Intent.createChooser(intentAlbum, ""), REQUEST_ALBUM); }
From source file:Fragments.VerificationFragment.java
private void changeProfilePicture() { /* Intent intent = new Intent(); /*from ww w .ja va2 s .c o m*/ intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select file to upload "), 0);*/ final CharSequence options[] = new CharSequence[] { "Take Photo", "Choose from Library", "Cancel" }; android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder( this.getActivity()); builder.setCancelable(false); builder.setTitle("Select your option:"); builder.setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { // the user clicked on options[which] if (options[item].equals("Take Photo")) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 0); } else if (options[item].equals("Choose from Library")) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select File"), 1); } else if (options[item].equals("Cancel")) { dialog.dismiss(); } } }); builder.show(); }
From source file:cn.net_show.doctor.activity.AuthActivity.java
public void onClick(View v) { switch (v.getId()) { case R.id.btn_back: this.finish(); break;// w w w . j a va2s . co m case R.id.authImage: Intent intent = new Intent(Intent.ACTION_PICK); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(intent, 1111); break; case R.id.btn_auth: if (isUpload) { Toast.makeText(this, "???", Toast.LENGTH_SHORT).show(); return; } if (uri == null) { Toast.makeText(this, "?", Toast.LENGTH_SHORT).show(); return; } else { if (pd == null) { getProcessDialog(); } pd.show(); String key = ""; if (rdgroup.getCheckedRadioButtonId() == R.id.rd_qw) { key = "license"; } else { key = "plate"; } auth(key); } break; default: break; } }
From source file:com.money.manager.ex.account.AccountListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // set show search setSearchMenuVisible(true);//www.j a va 2 s . co m // set default value setEmptyText(getActivity().getResources().getString(R.string.account_empty_list)); setHasOptionsMenu(true); int layout = Intent.ACTION_PICK.equals(mAction) ? android.R.layout.simple_list_item_multiple_choice : android.R.layout.simple_list_item_1; // create adapter MoneySimpleCursorAdapter adapter = new MoneySimpleCursorAdapter(getActivity(), layout, null, new String[] { Account.ACCOUNTNAME }, new int[] { android.R.id.text1 }, 0); setListAdapter(adapter); registerForContextMenu(getListView()); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); setListShown(false); // start loader getLoaderManager().initLoader(LOADER_ACCOUNT, null, this); // set icon searched setMenuItemSearchIconified(!Intent.ACTION_PICK.equals(mAction)); setFloatingActionButtonVisible(true); attachFloatingActionButtonToListView(); }
From source file:net.i2p.android.wizard.ui.I2PDestinationFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_wizard_page_single_text_field_picker, container, false); ((TextView) rootView.findViewById(android.R.id.title)).setText(mPage.getTitle()); ((TextView) rootView.findViewById(R.id.wizard_text_field_desc)).setText(mPage.getDesc()); Button b = (Button) rootView.findViewById(R.id.wizard_text_field_pick); b.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent ai = new Intent(getActivity(), AddressbookActivity.class); ai.setAction(Intent.ACTION_PICK); ai.setData(Uri.parse("content://net.i2p.addressbook/domains")); startActivityForResult(ai, REQUEST_ADDRESSBOOK_DOMAIN); }/*ww w . j av a 2s . com*/ }); mFieldView = ((TextView) rootView.findViewById(R.id.wizard_text_field)); mFieldView.setHint(mPage.getTitle()); if (mPage.getData().getString(Page.SIMPLE_DATA_KEY) != null) mFieldView.setText(mPage.getData().getString(Page.SIMPLE_DATA_KEY)); else if (mPage.getDefault() != null) { mFieldView.setText(mPage.getDefault()); mPage.getData().putString(Page.SIMPLE_DATA_KEY, mPage.getDefault()); } mFeedbackView = (TextView) rootView.findViewById(R.id.wizard_text_field_feedback); return rootView; }
From source file:org.botlibre.sdk.activity.WebMediumAdminActivity.java
public void changeIcon(View view) { Intent upload = new Intent(Intent.ACTION_PICK); upload.setType("image/*"); startActivityForResult(upload, 1); }
From source file:otmobile.FirstScreen.java
public void onGalleryClick(View view) { //First check the gallery permissions if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { //Permission is OK Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(galleryIntent, CHOOSE_IMAGE); } else {/* w w w .jav a2s .c o m*/ //Request Permission requestGalleryPermission(); } }
From source file:com.tz.ays.michael.fragments.RegistFragmentSecond.java
public void onClick(View v) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); switch (v.getId()) { case R.id.tv_card_front: startActivityForResult(intent, Constrant.PHOTO_CDRD_FRONT_DATA); break;/*w ww . j a v a 2 s . c o m*/ case R.id.tv_card_rear: startActivityForResult(intent, Constrant.PHOTO_CDRD_REAR_DATA); break; case R.id.tv_card: startActivityForResult(intent, Constrant.PHOTO_CDRD_WITH_DATA); break; default: break; } }