Guest User

Untitled

a guest
Jun 18th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. @Override
  2. public boolean onOptionsItemSelected(MenuItem item) {
  3. // Handle item selection
  4. switch (item.getItemId()) {
  5. case R.id.item:
  6. Uri uri = Uri.parse("android.resource://com.jai.desimeme/drawable/");
  7. Intent shareIntent = new Intent();
  8. shareIntent.setAction(Intent.ACTION_SEND);
  9. shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
  10. shareIntent.setType("image/jpeg");
  11. startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.share)));
  12. return true;
  13. default:
  14. return super.onOptionsItemSelected(item);
  15. }
  16. }
  17.  
  18. BitmapDrawable bm = (BitmapDrawable) yourImageView.getDrawable();
  19. Bitmap mysharebmp = bm.getBitmap();
  20. String path = Images.Media.insertImage(getContentResolver(),
  21. mysharebmp, "MyImage", null);
  22. Uri uri = Uri.parse(path);
  23. Intent sharingIntent = new Intent(Intent.ACTION_SEND);
  24. sharingIntent.setType("image/png");
  25. sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
  26. startActivity(Intent.createChooser(sharingIntent,
  27. "Share image using"));
  28.  
  29. shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
  30. sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
Add Comment
Please, Sign In to add comment