Created
June 7, 2014 11:15
-
-
Save lenamuit/f22a208ff00928a14339 to your computer and use it in GitHub Desktop.
Take image from View and share
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bitmap screenshot = Bitmap.createBitmap(_rootView.getWidth(), _rootView.getHeight(), Bitmap.Config.RGB_565); | |
_rootView.draw(new Canvas(screenshot)); | |
String path = Images.Media.insertImage(getContentResolver(), screenshot, "title", null); | |
Uri screenshotUri = Uri.parse(path); | |
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); | |
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
emailIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri); | |
emailIntent.setType("image/png"); | |
startActivity(Intent.createChooser(emailIntent, "Send email using")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment