开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜