When sharing an image with Intent.createChooser, my file disappears!
private void share() {
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file://" + filename));
开发者_Python百科startActivity(Intent.createChooser(share, "Share Tag"));
}
I implemented this simple function to be called from a menu, yet after I call it, the file I shared completely disappears -- it's as if the share is deleting it off of my storage. Why is it doing this, and how do I stop it??
Try doing this instead:
Uri uri = Uri.fromFile(new File(filename));
share.putExtra(Intent.EXTRA_STREAM, uri);
精彩评论