Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
protected void shareScreenShot() throws IOException {
final Intent shareIntent = new Intent(Intent.ACTION_SEND);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
} else {
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
shareIntent.setType("image/jpeg");
shareIntent.putExtra(Intent.EXTRA_STREAM, takeScreenShot());
startActivity(Intent.createChooser(shareIntent, getString(R.string.send_to)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.