List of usage examples for android.content Intent ACTION_GET_CONTENT
String ACTION_GET_CONTENT
To view the source code for android.content Intent ACTION_GET_CONTENT.
Click Source Link
From source file:de.vanita5.twittnuker.activity.support.ComposeActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT) private boolean openDocument() { final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); final String[] mimeTypes = { "image/png", "image/jpeg", "image/gif" }; intent.setType("image/*"); intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); try {/*from w w w. j a va 2 s . c o m*/ startActivityForResult(intent, REQUEST_OPEN_DOCUMENT); } catch (final ActivityNotFoundException e) { return false; } return true; }
From source file:org.kontalk.ui.AbstractComposeFragment.java
@TargetApi(Build.VERSION_CODES.KITKAT) private Intent createGalleryIntent(boolean useSAF) { Intent intent;//w w w .j av a 2 s. c o m if (!useSAF) { intent = SystemUtils.externalIntent(Intent.ACTION_GET_CONTENT) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } else { intent = SystemUtils.externalIntent(Intent.ACTION_OPEN_DOCUMENT); } return intent.addCategory(Intent.CATEGORY_OPENABLE).setType("image/*") .addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION).putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); }
From source file:info.guardianproject.otr.app.im.app.NewChatActivity.java
void startFilePicker() { Intent selectFile = new Intent(Intent.ACTION_GET_CONTENT); selectFile.setType("file/*"); Intent intentChooser = Intent.createChooser(selectFile, "Select File"); if (intentChooser != null) startActivityForResult(Intent.createChooser(selectFile, "Select File"), REQUEST_SEND_FILE); }
From source file:com.teeptrak.controller.MainActivity.java
private void openFileChooser(int aFileType) { final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType(aFileType == FILE_TYPE_ZIP ? DfuService.MIME_TYPE_ZIP : MIME_TYPE_TEXT); //intent.setType(DfuService.MIME_TYPE_ZIP); intent.addCategory(Intent.CATEGORY_OPENABLE); if (intent.resolveActivity(getPackageManager()) != null) { // file browser has been found on the device startActivityForResult(intent, REQUEST_SELECT_FILE); }//ww w .java2 s .c o m //else //{ // there is no any file browser app, let's try to download one // final View customView = getLayoutInflater().inflate(R.layout.app_file_browser, null); // final ListView appsList = (ListView) customView.findViewById(android.R.id.list); // appsList.setAdapter(new FileBrowserAppsAdapter(this)); // appsList.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // appsList.setItemChecked(0, true); // new AlertDialog.Builder(this).setTitle(R.string.dfu_alert_no_filebrowser_title).setView(customView) // .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { // @Override // public void onClick(final DialogInterface dialog, final int which) { // dialog.dismiss(); // } // }).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { // @Override // public void onClick(final DialogInterface dialog, final int which) { // final int pos = appsList.getCheckedItemPosition(); // if (pos >= 0) { // final String query = getResources().getStringArray(R.array.dfu_app_file_browser_action)[pos]; // final Intent storeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(query)); // startActivity(storeIntent); // } // } // }).show(); //} }
From source file:info.guardianproject.otr.app.im.app.NewChatActivity.java
void startAudioPicker() { Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); if (!isCallable(intent)) { intent = new Intent("android.provider.MediaStore.RECORD_SOUND"); intent.addCategory("android.intent.category.DEFAULT"); if (!isCallable(intent)) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("audio/*"); if (!isCallable(intent)) return; }/*from ww w . j a va 2s .c o m*/ } startActivityForResult(intent, REQUEST_SEND_AUDIO); // intent and requestCode of 1 }
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); }/*from w ww . j av a2s. c om*/ }
From source file:com.creativtrendz.folio.ui.FolioWebViewScroll.java
@SuppressLint("NewApi") protected void openFileInput(final ValueCallback<Uri> fileUploadCallbackFirst, final ValueCallback<Uri[]> fileUploadCallbackSecond) { if (mFileUploadCallbackFirst != null) { mFileUploadCallbackFirst.onReceiveValue(null); }/*from w w w.j ava 2 s . c o m*/ mFileUploadCallbackFirst = fileUploadCallbackFirst; if (mFileUploadCallbackSecond != null) { mFileUploadCallbackSecond.onReceiveValue(null); } mFileUploadCallbackSecond = fileUploadCallbackSecond; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType(mUploadableFileTypes); if (mFragment != null && mFragment.get() != null && Build.VERSION.SDK_INT >= 11) { mFragment.get().startActivityForResult(Intent.createChooser(i, getFileUploadPromptLabel()), mRequestCodeFilePicker); } else if (mActivity != null && mActivity.get() != null) { mActivity.get().startActivityForResult(Intent.createChooser(i, getFileUploadPromptLabel()), mRequestCodeFilePicker); } }
From source file:jahirfiquitiva.iconshowcase.activities.ShowcaseActivity.java
private void getAction() { String action;/*from www . ja va 2 s .c om*/ 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; } }