Basically it's as the title says. The only way to get the new image to share properly is to hit the remove button on whatever application it was sent to and then hit the back button. If I just hit the back button and run it again, it will show the same image I sent last time. I have confirmed the image is updated, it just doesn't clear the old shareIntent for some reason. Is there a way to force the ShareIntent to clear the previous one on back button press?
Code below(sorry about formatting, on mobile):
private Intent getShareIntent()
{
Intent shareIntent = new Intent(Intent.ACTION_SEND);
File sdCard = Environment.getExternalStorageDirectory();
File sharedFile = new File(sdCard+"/myPath/sharePicture.png");
Uri uri = Uri.fromFile(sharedFile);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
return shareIntent;
}
@Override
public boolean
onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_item_share:
//Saves a screenshot of the screen
screenShot(getActivity().findViewById(R.id.picture_location));
//Starts the ShareIntent activity
startActivity(getShareIntent());
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Please let me know if anything is unclear.
0 comments:
Post a Comment