List of usage examples for android.content Intent CATEGORY_OPENABLE
String CATEGORY_OPENABLE
To view the source code for android.content Intent CATEGORY_OPENABLE.
Click Source Link
From source file:edu.cmu.cylab.starslinger.view.HomeActivity.java
private void showFileAttach() { final List<Intent> allIntents = new ArrayList<Intent>(); // all openable... Intent contentIntent = new Intent(Intent.ACTION_GET_CONTENT); contentIntent.setType(SafeSlingerConfig.MIMETYPE_ADD_ATTACH); contentIntent.addCategory(Intent.CATEGORY_OPENABLE); // camera// ww w . ja va2s. c om Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); SafeSlinger.setTempCameraFileUri(SSUtil.makeCameraOutputUri()); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, SafeSlinger.getTempCameraFileUri()); allIntents.add(cameraIntent); // audio recorder Intent recorderIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); recorderIntent.putExtra(MediaStore.EXTRA_OUTPUT, SSUtil.makeRecorderOutputUri()); allIntents.add(recorderIntent); // our custom browser if (SSUtil.isExternalStorageReadable()) { Intent filePickIntent = new Intent(HomeActivity.this, FilePickerActivity.class); LabeledIntent fileIntent = new LabeledIntent(filePickIntent, filePickIntent.getPackage(), R.string.menu_FileManager, R.drawable.ic_menu_directory); allIntents.add(fileIntent); } // Chooser of file system options. Intent chooserIntent = Intent.createChooser(contentIntent, getString(R.string.title_ChooseFileLoad)); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, allIntents.toArray(new Parcelable[] {})); startActivityForResult(chooserIntent, VIEW_FILEATTACH_ID); }
From source file:com.android.mail.compose.ComposeActivity.java
@SuppressLint("NewApi") private void doAttach(String type) { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); i.setType(type);/*from ww w . j ava2 s. c o m*/ mAddingAttachment = true; startActivityForResult(Intent.createChooser(i, getText(R.string.select_attachment_type)), RESULT_PICK_ATTACHMENT); }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
void onImport() { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); PackageManager packageManager = getPackageManager(); List<ResolveInfo> infos = packageManager.queryIntentActivities(i, 0); if (infos.size() > 0) { startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_SETTINGS_FILE); } else {/* ww w .j a v a 2s . com*/ showDialog(DIALOG_NO_FILE_MANAGER); } }
From source file:com.tct.mail.compose.ComposeActivity.java
@SuppressLint("NewApi") private void doAttach(String type) { mAddingAttachment = true;//TS: yang.mei 2015-1-19 EMAIL BUGFIX_1441004 MOD //TS: zheng.zou 2015-11-30 EMAIL TASK_869664 ADD_S if (PermissionUtil.checkAndRequestPermissionForResult(this, Manifest.permission.READ_EXTERNAL_STORAGE, PermissionUtil.REQ_CODE_PERMISSION_ADD_ATTACHMENT)) { //TS: jin.dong 2015-12-17 EMAIL BUGFIX_1170083 MOD Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); i.setType(type);// ww w . j av a 2 s .c o m startActivityForResult(Intent.createChooser(i, getText(R.string.select_attachment_type)), RESULT_PICK_ATTACHMENT); } //TS: zheng.zou 2015-11-30 EMAIL TASK_869664 ADD_E }
From source file:com.codename1.impl.android.AndroidImplementation.java
public void openGallery(final ActionListener response, int type) { if (!isGalleryTypeSupported(type)) { throw new IllegalArgumentException("Gallery type " + type + " not supported on this platform."); }//from w ww .j av a 2 s .co m if (getActivity() == null) { throw new RuntimeException("Cannot open galery in background mode"); } if (!checkForPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, "This is required to browse the photos")) { return; } if (editInProgress()) { stopEditing(true); } final boolean multi; switch (type) { case Display.GALLERY_ALL_MULTI: multi = true; type = Display.GALLERY_ALL; break; case Display.GALLERY_VIDEO_MULTI: multi = true; type = Display.GALLERY_VIDEO; break; case Display.GALLERY_IMAGE_MULTI: multi = true; type = Display.GALLERY_IMAGE; break; case -9998: multi = true; type = -9999; break; default: multi = false; } callback = new EventDispatcher(); callback.addListener(response); Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); if (multi) { galleryIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); } if (type == Display.GALLERY_VIDEO) { galleryIntent.setType("video/*"); } else if (type == Display.GALLERY_IMAGE) { galleryIntent.setType("image/*"); } else if (type == Display.GALLERY_ALL) { galleryIntent.setType("image/* video/*"); } else if (type == -9999) { galleryIntent = new Intent(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { galleryIntent.setAction(Intent.ACTION_OPEN_DOCUMENT); } else { galleryIntent.setAction(Intent.ACTION_GET_CONTENT); } galleryIntent.addCategory(Intent.CATEGORY_OPENABLE); // set MIME type for image galleryIntent.setType("*/*"); galleryIntent.putExtra(Intent.EXTRA_MIME_TYPES, Display.getInstance().getProperty("android.openGallery.accept", "*/*").split(",")); } else { galleryIntent.setType("*/*"); } this.getActivity().startActivityForResult(galleryIntent, multi ? OPEN_GALLERY_MULTI : OPEN_GALLERY); }