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:mobisocial.bento.todo.ui.TodoListFragment.java
private void goGallery() { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_PICK); startActivityForResult(intent, REQUEST_GALLERY); }
From source file:com.collecdoo.fragment.main.RegisterDriverPhotoFragment.java
private void openImageIntent(int uploadIndex) { //EasyImage.openChooserWithGallery(this,"Please choose",0); File imageFile = ImageHelper.createFile(context, "extend_picture.jpg"); String cameraImageFullPath = imageFile.getAbsolutePath(); cameraOutputFileUri = Uri.fromFile(imageFile); // Camera.//from w ww .ja v a 2 s. c o m final List<Intent> cameraIntents = new ArrayList<Intent>(); final Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); final PackageManager packageManager = context.getPackageManager(); final List<ResolveInfo> listCam = packageManager.queryIntentActivities(captureIntent, 0); for (ResolveInfo res : listCam) { final String packageName = res.activityInfo.packageName; final Intent intent = new Intent(captureIntent); intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name)); intent.setPackage(packageName); intent.putExtra(MediaStore.EXTRA_OUTPUT, cameraOutputFileUri); cameraIntents.add(intent); } // Filesystem. final Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_PICK); // Chooser of filesystem options. final Intent chooserIntent = Intent.createChooser(galleryIntent, "Select Source"); // Add the camera options. chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[] {})); startActivityForResult(chooserIntent, uploadIndex); }
From source file:de.wikilab.android.friendica01.HomeActivity.java
void navigate(String arg1) { currentMMItem = arg1;/* w w w .j ava 2 s . c o m*/ if (arg1.equals("Timeline")) { navigatePostList("timeline"); } if (arg1.equals("Notifications")) { navigatePostList("notifications"); } if (arg1.equals("My Wall")) { navigatePostList("mywall"); } if (arg1.equals("Update My Status")) { navigateStatusUpdate(); } if (arg1.equals("Friends")) { navigateFriendList(); } if (arg1.equals("My Photo Albums")) { navigatePhotoGallery("myalbums"); } if (arg1.equals("Take Photo And Upload")) { Intent in = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takePhotoTarget = Max.getTempFile(); in.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(takePhotoTarget)); startActivityForResult(in, RQ_TAKE_PHOTO); } if (arg1.equals("Select Photo And Upload")) { Intent in = new Intent(Intent.ACTION_PICK); in.setType("image/*"); startActivityForResult(in, RQ_SELECT_PHOTO); } if (arg1.equals("Messages")) { //Intent in = new Intent(HomeActivity.this, MessagesActivity.class); //startActivity(in); navigateMessages("msg:all"); } if (arg1.equals("Preferences")) { navigatePreferences(); } if (arg1.equals("Log Out")) { SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences(HomeActivity.this) .edit(); //prefs.putString("login_server", null); //keep server and user ... prefs.putString("login_user", null); prefs.putString("login_password", null); //...only remove password prefs.commit(); finish(); } }
From source file:com.stoyanr.feeder.activity.ChannelsActivity.java
private boolean shouldSetResult(String action) { return action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT); }
From source file:com.vmihalachi.turboeditor.activity.HomeActivity.java
/** * Parses the intent//w w w. j a v a 2 s . c o m */ private void parseIntent(Intent intent) { final String action = intent.getAction(); final String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action) || Intent.ACTION_PICK.equals(action) && type != null) { // Post the NewFileOpened Event EventBus.getDefault().postSticky(new NewFileOpened(intent.getData().getPath())); } }
From source file:com.money.manager.ex.currency.list.CurrencyListFragment.java
@Override protected void setResult() { Intent result;// www .j a v a2 s .co m if (Intent.ACTION_PICK.equals(mAction)) { // create intent Cursor cursor = ((CurrencyListAdapter) getListAdapter()).getCursor(); for (int i = 0; i < getListView().getCount(); i++) { if (getListView().isItemChecked(i)) { cursor.moveToPosition(i); result = new Intent(); result.putExtra(CurrencyListActivity.INTENT_RESULT_CURRENCYID, cursor.getInt(cursor.getColumnIndex(Currency.CURRENCYID))); result.putExtra(CurrencyListActivity.INTENT_RESULT_CURRENCYNAME, cursor.getString(cursor.getColumnIndex(Currency.CURRENCYNAME))); getActivity().setResult(Activity.RESULT_OK, result); return; } } } getActivity().setResult(CurrencyListActivity.RESULT_CANCELED); }
From source file:br.com.GUI.perfil.PerfilAluno.java
public void usarGaleria() { Calendar c = Calendar.getInstance(); FILE_NAME = c.get(Calendar.DAY_OF_MONTH) + "_" + c.get(Calendar.YEAR) + ".jpg"; Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) { photo = new File(android.os.Environment.getExternalStorageDirectory(), FILE_NAME); } else {//from w w w . j a v a2 s .c o m photo = new File(getActivity().getCacheDir(), FILE_NAME); } if (photo != null) { intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); selectedImageUri = Uri.fromFile(photo); startActivityForResult(intent, 200); } }
From source file:org.y20k.transistor.PlayerActivityFragment.java
@Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case PERMISSION_REQUEST_READ_EXTERNAL_STORAGE: { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission granted - get system picker for images Intent pickImageIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(pickImageIntent, REQUEST_LOAD_IMAGE); } else {/* w ww. j a v a 2 s. c om*/ // permission denied } } } }
From source file:com.nekomeshi312.whiteboardcorrection.CameraViewFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub if (MyDebug.DEBUG) Log.i(LOG_TAG, item.toString()); Intent intent;/* www . j a va 2 s . c om*/ switch (item.getItemId()) { case R.id.menu_shutter_button: LineDetectCallback cb = (LineDetectCallback) mParentActivity; cb.onShutterReleased(); return true; case R.id.menu_load_and_correct: // intent = new Intent(Intent.ACTION_PICK); intent.setType("image/jpeg"); // startActivityForResult(intent, ACTIVIY_REQUEST_GALLERY_FILE_SELECT); return true; case R.id.menu_image_check: // intent = new Intent(Intent.ACTION_PICK); intent.setType("image/jpeg"); // startActivityForResult(intent, ACTIVIY_REQUEST_GALLERY_IMAGE_CHECK); return true; case R.id.menu_settings: mCameraSettingPrefOpen = true; intent = new Intent(mParentActivity, CameraSettingActivity.class); startActivityForResult(intent, ACTIVIY_REQUEST_CAMERA_SETTING_PREF); return true; default: break; } return super.onOptionsItemSelected(item); }
From source file:cn.edu.nuc.seeworld.fg.ColorFragment.java
private void getpicfromalbum() { Intent picture = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(picture, PHOTO); }