List of usage examples for android.content Intent EXTRA_STREAM
String EXTRA_STREAM
To view the source code for android.content Intent EXTRA_STREAM.
Click Source Link
From source file:info.papdt.blacklight.ui.common.AbsImageActivity.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { final int id = item.getItemId(); if (id == android.R.id.home) { finish();// ww w .jav a 2s . co m return true; } else if (id == R.id.save || id == R.id.share) { final int current = mPager.getCurrentItem(); if (!mLoaded[current]) { Toast.makeText(this, R.string.not_loaded, Toast.LENGTH_SHORT).show(); } else { PermissionUtility.storage(this, new Runnable() { @Override public void run() { String path = saveLargePic(current); if (id == R.id.save) { if (path == null) { Toast.makeText(AbsImageActivity.this, R.string.save_failed, Toast.LENGTH_SHORT) .show(); } else { String msg = String.format(getResources().getString(R.string.saved_to), path); Toast.makeText(AbsImageActivity.this, msg, Toast.LENGTH_SHORT).show(); } } if (id == R.id.share) { if (path != null) { File f = new File(path); Uri u = Uri.fromFile(f); ShareActionProvider share = (ShareActionProvider) MenuItemCompat .getActionProvider(item); Intent i = new Intent(); i.setAction(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_STREAM, u); i.setType("image/*"); share.setShareIntent(i); } } } }); } return true; } else { return super.onOptionsItemSelected(item); } }
From source file:it.mobistego.MainActivity.java
@Override public void itemViewOnShare(MobiStegoItem mobiStegoItem) { Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("vnd.android.cursor.dir/*"); File f = mobiStegoItem.getBitmap(); if (f != null) { emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.send))); }//from w w w. ja v a2 s . c o m }
From source file:cz.maresmar.sfm.app.SfmApp.java
private void sendFeedback(Context context, String subject) { Timber.i("Device %s (%s) on SDK %d", Build.DEVICE, Build.MANUFACTURER, Build.VERSION.SDK_INT); File logFile = getLogFile();/*from w w w . j a va 2 s.c om*/ Uri logUri = FileProvider.getUriForFile(this, "cz.maresmar.sfm.FileProvider", logFile); Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "mmrmartin+dev" + '@' + "gmail.com" }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "[sfm] " + subject); emailIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.feedback_mail_text)); emailIntent.putExtra(Intent.EXTRA_STREAM, logUri); emailIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); List<ResolveInfo> resInfoList = getPackageManager().queryIntentActivities(emailIntent, PackageManager.MATCH_DEFAULT_ONLY); for (ResolveInfo resolveInfo : resInfoList) { String packageName = resolveInfo.activityInfo.packageName; context.grantUriPermission(packageName, logUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } context.startActivity( Intent.createChooser(emailIntent, getString(R.string.feedback_choose_email_app_dialog))); }
From source file:com.odoo.base.ir.Attachment.java
public ODataRow handleResult(int requestCode, Intent data) { Uri uri = null;//from www . j av a2 s . com Bitmap bitmap = null; switch (requestCode) { case REQUEST_AUDIO: uri = data.getData(); break; case REQUEST_CAMERA: bitmap = (Bitmap) data.getExtras().get("data"); uri = data.getData(); break; case REQUEST_IMAGE: uri = data.getData(); break; case REQUEST_FILE: uri = data.getData(); break; default: // Single Attachment (share) uri = data.getParcelableExtra(Intent.EXTRA_STREAM); break; } return uriToDataRow(uri, bitmap); }
From source file:com.joravasal.comicagg.ComicDetailFragment.java
@TargetApi(14) @Override//w w w .j a v a 2 s. co m public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { Log.d(TAG, "OnCreateOptionsMenu"); inflater.inflate(R.menu.comic_selected_extra, menu); // if (!((ComicListActivity) getActivity()).showUnread) // menu.findItem(R.id.menu_show_all).setTitle( // R.string.menu_show_unread); ShareActionProvider mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share) .getActionProvider(); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); // Uri uri = Uri.parse(comicItem.url); shareIntent.putExtra(Intent.EXTRA_STREAM, comicItem.url); mShareActionProvider.setShareIntent(shareIntent); }
From source file:com.dycody.android.idealnote.GalleryActivity.java
private void shareMedia() { Attachment attachment = images.get(mViewPager.getCurrentItem()); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(StorageHelper.getMimeType(this, attachment.getUri())); intent.putExtra(Intent.EXTRA_STREAM, attachment.getUri()); startActivity(intent);// w w w. j av a 2 s .c o m }
From source file:com.openerp.base.ir.Attachment.java
public OEDataRow handleResult(int requestCode, Intent data) { Uri uri = null;// w w w. ja v a 2 s. c o m Bitmap bitmap = null; switch (requestCode) { case REQUEST_AUDIO: uri = data.getData(); break; case REQUEST_CAMERA: bitmap = (Bitmap) data.getExtras().get("data"); uri = data.getData(); break; case REQUEST_IMAGE: uri = data.getData(); break; case REQUEST_FILE: uri = data.getData(); break; default: // Single Attachment (share) uri = data.getParcelableExtra(Intent.EXTRA_STREAM); break; } return uriToDataRow(uri, bitmap); }
From source file:com.piusvelte.sonet.core.SonetCreatePost.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent();/*from ww w . j a v a 2 s . com*/ if (intent != null) { String action = intent.getAction(); if ((action != null) && action.equals(Intent.ACTION_SEND)) { if (intent.hasExtra(Intent.EXTRA_STREAM)) getPhoto((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM)); if (intent.hasExtra(Intent.EXTRA_TEXT)) { final String text = intent.getStringExtra(Intent.EXTRA_TEXT); mMessage.setText(text); mCount.setText(Integer.toString(text.length())); } chooseAccounts(); } else { Uri data = intent.getData(); if ((data != null) && data.toString().contains(Accounts.getContentUri(this).toString())) { // default to the account passed in, but allow selecting additional accounts Cursor account = this.getContentResolver().query(Accounts.getContentUri(this), new String[] { Accounts._ID, Accounts.SERVICE }, Accounts._ID + "=?", new String[] { data.getLastPathSegment() }, null); if (account.moveToFirst()) mAccountsService.put(account.getLong(0), account.getInt(1)); account.close(); } else if (intent.hasExtra(Widgets.INSTANT_UPLOAD)) { // check if a photo path was passed and prompt user to select the account setPhoto(intent.getStringExtra(Widgets.INSTANT_UPLOAD)); chooseAccounts(); } } } }
From source file:com.dnielfe.manager.AppManager.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); int index = info.position; String packagename = mAppList.get(index).packageName; switch (item.getItemId()) { case ID_LAUNCH: Intent i = pm.getLaunchIntentForPackage(packagename); startActivity(i);//from w w w.ja v a 2 s.com break; case ID_MANAGE: startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + packagename))); break; case ID_UNINSTALL: Intent i1 = new Intent(Intent.ACTION_DELETE); i1.setData(Uri.parse("package:" + packagename)); startActivity(i1); get_downloaded_apps(); break; case ID_MARKET: Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=" + packagename)); startActivity(intent1); break; case ID_SEND: try { ApplicationInfo info1 = pm.getApplicationInfo(packagename, 0); String source_dir = info1.sourceDir; File file = new File(source_dir); Uri uri11 = Uri.fromFile(file.getAbsoluteFile()); Intent infointent = new Intent(Intent.ACTION_SEND); infointent.setType("application/zip"); infointent.putExtra(Intent.EXTRA_STREAM, uri11); startActivity(Intent.createChooser(infointent, getString(R.string.share))); } catch (Exception e) { Toast.makeText(AppManager.this, "Error", Toast.LENGTH_SHORT).show(); } break; } return false; }
From source file:com.luan.thermospy.android.fragments.temperaturelog.TemperatureGraph.java
private Intent createShareIntent() { File outputDir = getActivity().getExternalCacheDir(); // context being the Activity pointer File outputFile = null;/* w ww . j a v a 2s.co m*/ try { outputFile = File.createTempFile("export", ".csv", outputDir); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(outputFile.getAbsolutePath())); for (TemperatureEntry entry : mTemperatureList) { writer.write(entry.toCsv() + "\n"); } writer.flush(); } catch (IOException e) { } finally { try { if (writer != null) writer.close(); } catch (IOException e) { } } } catch (IOException e) { e.printStackTrace(); } if (outputFile != null) { Uri u1 = Uri.fromFile(outputFile); Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Temperature log from Thermospy"); sendIntent.putExtra(Intent.EXTRA_STREAM, u1); sendIntent.setType("application/csv"); sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); return sendIntent; } return null; }