In my Android Application I want to implement functionality of sharing screenshot. For sharing purpose I am using ShareActionProvider as guided by this link :-http://developer.android.com/training/sharing/shareaction.html
Code for setting share Intent which is in onCreateOptionMenu as below:-
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.countdown, menu);
mActionReward = menu.findItem(R.id.action_rewards);
mActionShare = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(mActionShare);
updateShareIntent();
mShareActionProvider.setShareIntent(emailIntent);
return super.onCreateOptionsMenu(menu);
}
where "emailIntent" is class field updateShareIntent() is method to update Intent which is as follows :-
private void updateShareIntent() {
try {
File file = new File(saveImage(false));
MediaStore.Images.Media.insertImage(getContentResolver(), file.getAbsolutePath(),getResources().getString(R.string.title), "");
emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("jpeg/image");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
When user share the screenshot , screenshot image is screen that comes while starting the application/activity and not current. Kindly provide me solution to share current screenshot. It will be helpful for me.