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:com.keylesspalace.tusky.ComposeActivity.java
private void initiateMediaPicking() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); String[] mimeTypes = new String[] { "image/*", "video/*" }; intent.setType("*/*");/*from ww w. jav a 2s . co m*/ intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); startActivityForResult(intent, MEDIA_PICK_RESULT); }
From source file:android_network.hetnet.vpn_service.ActivitySettings.java
private Intent getIntentCreateExport() { Intent intent;//w w w . ja v a 2s . co m if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { if (Util.isPackageInstalled("org.openintents.filemanager", this)) { intent = new Intent("org.openintents.action.PICK_DIRECTORY"); } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData( Uri.parse("https://play.google.com/store/apps/details?id=org.openintents.filemanager")); } } else { intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); // text/xml intent.putExtra(Intent.EXTRA_TITLE, "netguard_" + new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".xml"); } return intent; }
From source file:com.slarker.tech.hi0734.view.widget.webview.AdvancedWebView.java
@SuppressLint("NewApi") protected void openFileInput(final ValueCallback<Uri> fileUploadCallbackFirst, final ValueCallback<Uri[]> fileUploadCallbackSecond, final boolean allowMultiple) { if (mFileUploadCallbackFirst != null) { mFileUploadCallbackFirst.onReceiveValue(null); }//from w w w .ja v a 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); if (allowMultiple) { if (Build.VERSION.SDK_INT >= 18) { i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); } } 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:org.wheelmap.android.fragment.POIDetailFragment.java
public void startGetPhotoFromGalleryIntent() { if (Build.VERSION.SDK_INT < 19) { Intent intent = new Intent(); intent.setType("image/jpeg"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, Request.REQUESTCODE_PHOTO); } else {/*from www.jav a 2 s. c o m*/ final String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"; Intent intent = new Intent(ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/jpeg"); startActivityForResult(intent, Request.GALLERY_KITKAT_INTENT_CALLED); } }
From source file:com.apptentive.android.sdk.module.engagement.interaction.fragment.MessageCenterFragment.java
@Override public void onAttachImage() { try {//from w w w . j ava2 s . c o m if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {//prior Api level 19 Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); Intent chooserIntent = Intent.createChooser(intent, null); startActivityForResult(chooserIntent, Constants.REQUEST_CODE_PHOTO_FROM_SYSTEM_PICKER); } else { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/*"); Intent chooserIntent = Intent.createChooser(intent, null); startActivityForResult(chooserIntent, Constants.REQUEST_CODE_PHOTO_FROM_SYSTEM_PICKER); } imagePickerStillOpen = true; } catch (Exception e) { e.printStackTrace(); imagePickerStillOpen = false; ApptentiveLog.d("can't launch image picker"); } }
From source file:android_network.hetnet.vpn_service.ActivitySettings.java
private Intent getIntentOpenExport() { Intent intent;/*from ww w .j a va 2 s . c o m*/ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) intent = new Intent(Intent.ACTION_GET_CONTENT); else intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); // text/xml return intent; }
From source file:android_network.hetnet.vpn_service.ActivitySettings.java
private Intent getIntentOpenHosts() { Intent intent;//w ww.j a v a2s. co m if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) intent = new Intent(Intent.ACTION_GET_CONTENT); else intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); // text/plain return intent; }
From source file:com.owncloud.android.ui.activity.FileDisplayActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog dialog = null;//from www. j a v a2s . c om AlertDialog.Builder builder; switch (id) { case DIALOG_SHORT_WAIT: { ProgressDialog working_dialog = new ProgressDialog(this); working_dialog.setMessage(getResources().getString(R.string.wait_a_moment)); working_dialog.setIndeterminate(true); working_dialog.setCancelable(false); dialog = working_dialog; break; } case DIALOG_CHOOSE_UPLOAD_SOURCE: { String[] items = null; String[] allTheItems = { getString(R.string.actionbar_upload_files), getString(R.string.actionbar_upload_from_apps), getString(R.string.actionbar_failed_instant_upload) }; String[] commonItems = { getString(R.string.actionbar_upload_files), getString(R.string.actionbar_upload_from_apps) }; if (InstantUploadActivity.IS_ENABLED) items = allTheItems; else items = commonItems; builder = new AlertDialog.Builder(this); builder.setTitle(R.string.actionbar_upload); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { // if (!mDualPane) { Intent action = new Intent(FileDisplayActivity.this, UploadFilesActivity.class); action.putExtra(UploadFilesActivity.EXTRA_ACCOUNT, FileDisplayActivity.this.getAccount()); startActivityForResult(action, ACTION_SELECT_MULTIPLE_FILES); // } else { // TODO create and handle new fragment // LocalFileListFragment // } } else if (item == 1) { Intent action = new Intent(Intent.ACTION_GET_CONTENT); action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult( Intent.createChooser(action, getString(R.string.upload_chooser_title)), ACTION_SELECT_CONTENT_FROM_APPS); } else if (item == 2 && InstantUploadActivity.IS_ENABLED) { Intent action = new Intent(FileDisplayActivity.this, InstantUploadActivity.class); action.putExtra(FileUploader.KEY_ACCOUNT, FileDisplayActivity.this.getAccount()); startActivity(action); } } }); dialog = builder.create(); break; } case DIALOG_SSL_VALIDATOR: { dialog = SslValidatorDialog.newInstance(this, mLastSslUntrustedServerResult, this); break; } case DIALOG_CERT_NOT_SAVED: { builder = new AlertDialog.Builder(this); builder.setMessage(getResources().getString(R.string.ssl_validator_not_saved)); builder.setCancelable(false); builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); }; }); dialog = builder.create(); break; } default: dialog = null; } return dialog; }
From source file:com.maskyn.fileeditorpro.activity.MainActivity.java
public void OpenFile(View view) { if (Device.hasKitKatApi() && PreferenceHelper.getUseStorageAccessFramework(this)) { // ACTION_OPEN_DOCUMENT is the intent to choose a file via the system's file // browser. Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); // Filter to only show results that can be "opened", such as a // file (as opposed to a list of contacts or timezones) intent.addCategory(Intent.CATEGORY_OPENABLE); // Filter to show only images, using the image MIME data type. // If one wanted to search for ogg vorbis files, the type would be "audio/ogg". // To search for all documents available via installed storage providers, // it would be "*/*". intent.setType("*/*");/*from ww w .j av a 2 s .co m*/ startActivityForResult(intent, READ_REQUEST_CODE); } else { Intent subActivity = new Intent(MainActivity.this, SelectFileActivity.class); subActivity.putExtra("action", SelectFileActivity.Actions.SelectFile); AnimationUtils.startActivityWithScale(this, subActivity, true, SELECT_FILE_CODE, view); } }
From source file:org.sogrey.frame.utils.FileUtil.java
/** * app//w ww. jav a 2 s . co m * * @param context * * @author Sogrey * @date 2015-11-27?1:56:55 */ public static void openFolder(Context context, String path) { // Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // Uri uri = Uri.parse(path); // intent.setDataAndType(uri, "text/csv"); // try { // context.startActivity(Intent.createChooser(intent, "Open folder")); // } catch (Exception e) { // } // File root = new File(path); // Uri uri = Uri.fromFile(root); // Intent intent = new Intent(); // intent.setAction(android.content.Intent.ACTION_VIEW); // intent.setData(uri); // context.startActivity(intent); // Intent intent = new Intent(); // String videoPath = path;// // File file = new File(videoPath); // Uri uri = Uri.fromFile(file); // intent.setData(uri); // intent.setAction(android.content.Intent.ACTION_VIEW);// "com.xxx.xxx" // ??? // try { // context.startActivity(intent); // } catch (ActivityNotFoundException e) { // e.printStackTrace(); // } // Intent i = new Intent(Intent.ACTION_GET_CONTENT); // // i.setAction(android.content.Intent.ACTION_VIEW); // File file = new File(path); // i.setDataAndType(Uri.fromFile(file), "file/*"); // try { // context.startActivity(i); // } catch (Exception e) { // } // Intent intent = new Intent(); // File file = new File(path); // intent.setAction(android.content.Intent.ACTION_VIEW); // // intent.setData(Uri.fromFile(file)); // intent.setDataAndType(Uri.fromFile(file), "file/*"); // try { // context.startActivity(intent); // } catch (Exception e) { // } Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // intent.setType("*/*"); intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); File file = new File(path); intent.setData(Uri.fromFile(file)); // intent.setDataAndType(Uri.fromFile(file), "*/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); try { context.startActivity(intent); } catch (ActivityNotFoundException ex) { ToastUtil.showToast(context, "?"); } }