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:net.mceoin.cominghome.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.fake_arrived: if ((structure_id != null) && (!structure_id.isEmpty())) { FenceHandling.arrivedHome(getApplicationContext()); }//from w ww . j av a2 s . co m return true; case R.id.fake_left: if ((structure_id != null) && (!structure_id.isEmpty())) { FenceHandling.leftHome(getApplicationContext()); } return true; case R.id.fake_left_work: if ((structure_id != null) && (!structure_id.isEmpty())) { FenceHandling.leftWork(getApplicationContext()); } return true; case R.id.stop_tracking: LocationService.sendTrackingStop(getApplicationContext()); return true; case R.id.settings: startActivity(new Intent(this, SettingsActivity.class)); return true; case R.id.select_structure: Intent pickContactIntent = new Intent(Intent.ACTION_PICK, StructuresValues.Structures.CONTENT_URI); startActivityForResult(pickContactIntent, REQUEST_PICK_STRUCTURE); return true; case R.id.history: startActivity(new Intent(this, HistoryActivity.class)); return true; case R.id.about_menu: showAbout(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.givon.anhao.activity.AnhaoMainActivity.java
/** * ?//from w w w . j a v a2 s . c o m */ public void selectPicFromLocal() { Intent intent; 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); } startActivityForResult(intent, ChatActivity.REQUEST_CODE_LOCAL); }
From source file:free.yhc.feeder.ChannelListFragment.java
private void onContext_pickIcon(final long cid) { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); mCidPickImage = cid;//from w ww.ja v a2s . co m try { startActivityForResult(Intent.createChooser(i, getResources().getText(R.string.pick_icon)), REQC_PICK_IMAGE); } catch (ActivityNotFoundException e) { UiHelper.showTextToast(getActivity(), R.string.warn_find_gallery_app); return; } }
From source file:com.google.ytdl.MainActivity.java
public void pickFile(View view) { Intent intent = new Intent(Intent.ACTION_PICK); // TODO // ACTION_GET_CONTENT intent.setType("video/*"); startActivityForResult(intent, RESULT_PICK_IMAGE_CROP); mButton.setEnabled(true);//from ww w.j ava 2 s . c om }
From source file:com.money.manager.ex.transactions.EditTransactionCommonFunctions.java
/** * Initialize Category selector.// w w w.ja v a2 s.c o m * @param datasetName name of the dataset (TableBudgetSplitTransactions.class.getSimpleName()) */ public void initCategoryControls(final String datasetName) { // keep the dataset name for later. this.mSplitCategoryEntityName = datasetName; this.viewHolder.categoryTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!isSplitSelected()) { // select first category. Intent intent = new Intent(getActivity(), CategoryListActivity.class); intent.setAction(Intent.ACTION_PICK); getActivity().startActivityForResult(intent, RequestCodes.CATEGORY); } else { // select split categories. showSplitCategoriesForm(mSplitCategoryEntityName); } // results are handled in onActivityResult. } }); }
From source file:rpassmore.app.fillthathole.ViewHazardActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case ADD_PHOTO_DIALOG_ID: // Create our AlertDialog Builder builder = new AlertDialog.Builder(this); builder.setMessage(/*from ww w . j a va 2 s. c o m*/ "You can attach a photo of the hazard to your report. Would you like to take a new photo or use an existing one?") .setCancelable(true).setPositiveButton("New photo", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String filename = System.currentTimeMillis() + ".jpg"; File imageDirectory = new File( Environment.getExternalStorageDirectory() + "/FillThatHole", filename); ContentValues values = new ContentValues(); values.put(Images.Media.MIME_TYPE, "image/jpeg"); values.put(Media.DESCRIPTION, "FillThatHole Image"); values.put(Media.DATA, imageDirectory.getPath()); values.put(MediaStore.Images.Media.TITLE, filename); // start the camera and take a new photo Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); capturedImageURI = getContentResolver() .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageURI); startActivityForResult(cameraIntent, PICTURE_ACTIVITY); } }).setNegativeButton("Existing photo", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // select photo from gallery Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, PICK_PHOTO_ACTIVITY); } }); AlertDialog dialog = builder.create(); dialog.show(); return dialog; } return super.onCreateDialog(id); }
From source file:com.slim.turboeditor.activity.MainActivity.java
/** * Parses the intent/*from w ww . jav a 2 s.co 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) { Uri uri = intent.getData(); File newFile = new File(uri.getPath()); newFileToOpen(newFile, ""); } else if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { newFileToOpen(null, intent.getStringExtra(Intent.EXTRA_TEXT)); } } }
From source file:foam.littlej.android.app.ui.phone.AddReportActivity.java
/** * Create various dialog// w ww . ja va 2s . c o m */ @Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_ERROR_NETWORK: { AlertDialog dialog = (new AlertDialog.Builder(this)).create(); dialog.setTitle(getString(R.string.network_error)); dialog.setMessage(getString(R.string.network_error_msg)); dialog.setButton2(getString(R.string.ok), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.setCancelable(false); return dialog; } case DIALOG_ERROR_SAVING: { AlertDialog dialog = (new AlertDialog.Builder(this)).create(); dialog.setTitle(getString(R.string.network_error)); dialog.setMessage(getString(R.string.file_system_error_msg)); dialog.setButton2(getString(R.string.ok), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.setCancelable(false); return dialog; } case DIALOG_CHOOSE_IMAGE_METHOD: { AlertDialog dialog = (new AlertDialog.Builder(this)).create(); dialog.setTitle(getString(R.string.choose_method)); dialog.setMessage(getString(R.string.how_to_select_pic)); dialog.setButton(getString(R.string.gallery_option), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, REQUEST_CODE_IMAGE); dialog.dismiss(); } }); dialog.setButton2(getString(R.string.cancel), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.setButton3(getString(R.string.camera_option), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, PhotoUtils.getPhotoUri(photoName, AddReportActivity.this)); startActivityForResult(intent, REQUEST_CODE_CAMERA); dialog.dismiss(); } }); dialog.setCancelable(false); return dialog; } case DIALOG_MULTIPLE_CATEGORY: { if (showCategories() != null) { return new AlertDialog.Builder(this).setTitle(R.string.choose_categories) .setMultiChoiceItems(showCategories(), setCheckedCategories(), new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { // see if categories have previously if (isChecked) { mVectorCategories.add(mCategoriesId.get(whichButton)); mError = false; } else { mVectorCategories.remove(mCategoriesId.get(whichButton)); } setSelectedCategories(mVectorCategories); } }) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { /* User clicked Yes so do some stuff */ } }).create(); } } case TIME_DIALOG_ID: return new TimePickerDialog(this, mTimeSetListener, mCalendar.get(Calendar.HOUR), mCalendar.get(Calendar.MINUTE), false); case DATE_DIALOG_ID: return new DatePickerDialog(this, mDateSetListener, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH)); case DIALOG_SHOW_MESSAGE: AlertDialog.Builder messageBuilder = new AlertDialog.Builder(this); messageBuilder.setMessage(mErrorMessage).setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog showDialog = messageBuilder.create(); showDialog.show(); break; case DIALOG_SHOW_REQUIRED: AlertDialog.Builder requiredBuilder = new AlertDialog.Builder(this); requiredBuilder.setTitle(R.string.required_fields); requiredBuilder.setMessage(mErrorMessage).setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog showRequiredDialog = requiredBuilder.create(); showRequiredDialog.show(); break; // prompt for unsaved changes case DIALOG_SHOW_PROMPT: { AlertDialog dialog = (new AlertDialog.Builder(this)).create(); dialog.setTitle(getString(R.string.unsaved_changes)); dialog.setMessage(getString(R.string.want_to_cancel)); dialog.setButton(getString(R.string.no), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.setButton2(getString(R.string.yes), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { new DiscardTask(AddReportActivity.this).execute((String) null); finish(); dialog.dismiss(); } }); dialog.setCancelable(false); return dialog; } // prompt for report deletion case DIALOG_SHOW_DELETE_PROMPT: { AlertDialog dialog = (new AlertDialog.Builder(this)).create(); dialog.setTitle(getString(R.string.delete_report)); dialog.setMessage(getString(R.string.want_to_delete)); dialog.setButton(getString(R.string.no), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.setButton2(getString(R.string.yes), new Dialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // delete report deleteReport(); dialog.dismiss(); } }); dialog.setCancelable(false); return dialog; } } return null; }
From source file:itcr.gitsnes.MainActivity.java
public void select_image(View view) { flag = false;/*from w w w .ja v a 2 s . c o m*/ Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); }
From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_client.ui.activity.MessagesActivity.java
private void takeGallery() { fromGallery = true;//from w w w . java 2 s . c om Intent photoLibraryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); photoLibraryIntent.setType("image/* video/*"); startActivityForResult(photoLibraryIntent, AppUtils.ACTION_GALLERY); }