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:no.nordicsemi.android.nrftoolbox.dfu.DfuActivity.java
/** * Called when Select File was pressed/* w w w .j a va2 s .c o m*/ * * @param view * a button that was pressed */ public void onSelectFileClicked(final View view) { final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("application/octet-stream"); intent.addCategory(Intent.CATEGORY_OPENABLE); if (intent.resolveActivity(getPackageManager()) != null) { // file browser has been found on the device startActivityForResult(intent, SELECT_FILE_REQ); } 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(android.R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); } }).setPositiveButton(android.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:com.anjalimacwan.MainActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT) private void reallyExportNote() { String filename = ""; try {/*from ww w . j a va 2 s . co m*/ filename = loadNoteTitle(filesToExport[fileBeingExported].toString()); } catch (IOException e) { /* Gracefully fail */ } Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TITLE, generateFilename(filename)); try { startActivityForResult(intent, EXPORT); } catch (ActivityNotFoundException e) { showToast(R.string.error_exporting_notes); } }
From source file:com.example.android.pharmacyinventory.EditorActivity.java
public void openImageSelector() { Intent intent;//ww w . j a v a2s .c o m if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); } intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST); }
From source file:android_network.hetnet.vpn_service.ActivityLog.java
private Intent getIntentPCAPDocument() { Intent intent;/*from w w w .j a va 2 s . 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("application/octet-stream"); intent.putExtra(Intent.EXTRA_TITLE, "netguard_" + new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".pcap"); } return intent; }
From source file:eu.faircode.adblocker.ActivityLog.java
private Intent getIntentPCAPDocument() { Intent intent;// www . j a v a2s.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("application/octet-stream"); intent.putExtra(Intent.EXTRA_TITLE, "adblocker_" + new SimpleDateFormat("yyyyMMdd").format(new Date().getTime()) + ".pcap"); } return intent; }
From source file:com.github.mjdev.libaums.usbfileman.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.create_file: new NewFileDialog().show(getFragmentManager(), "NEW_FILE"); return true; case R.id.create_dir: new NewDirDialog().show(getFragmentManager(), "NEW_DIR"); return true; case R.id.create_big_file: createBigFile();//from w ww . j a v a 2 s . co m return true; case R.id.paste: move(); return true; case R.id.stop_http_server: if (serverService != null) { serverService.stopServer(); } return true; case R.id.run_tests: startActivity(new Intent(this, LibAumsTest.class)); return true; case R.id.open_storage_provider: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (device != null) { Log.d(TAG, "Closing device first"); device.close(); } Intent intent = new Intent(); intent.setAction(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); String[] extraMimeTypes = { "image/*", "video/*" }; intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeTypes); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); startActivityForResult(intent, OPEN_STORAGE_PROVIDER_RESULT); } return true; case R.id.copy_from_storage_provider: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); startActivityForResult(intent, COPY_STORAGE_PROVIDER_RESULT); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:uno.weichen.abnd10_inventoryapp.DetailActivity.java
public void openImageSelector(View view) { Intent intent;// w w w . j a v a2 s .c om if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); } intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST); }
From source file:ca.rmen.android.scrumchatter.main.MainActivity.java
private void startFileChooser() { final Intent importIntent; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) importIntent = new Intent(Intent.ACTION_GET_CONTENT); else//from w ww. j av a 2s . c o m importIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT); importIntent.setType("*/*"); importIntent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(Intent.createChooser(importIntent, getResources().getText(R.string.action_import)), ACTIVITY_REQUEST_CODE_IMPORT); }
From source file:jackpal.androidterm.TermPreferences.java
private void doFilePicker() { AlertDialog.Builder bld = new AlertDialog.Builder(this); bld.setIcon(android.R.drawable.ic_dialog_info); bld.setMessage(this.getString(R.string.font_file_error)); bld.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss();/*from w w w.j a v a 2s. c o m*/ Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("application/octet-stream"); startActivityForResult(intent, REQUEST_FONT_PICKER); } }); bld.setNegativeButton(this.getString(android.R.string.no), null); final Activity activity = this; bld.setNeutralButton(this.getString(R.string.entry_fontfile_default), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(activity); sp.edit().putString(FONT_FILENAME, activity.getString(R.string.entry_fontfile_default)) .apply(); } }); bld.create().show(); }