本文介绍了当共享与Intent.createChooser图像,我的文件消失了!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void share() {
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file://" + filename));
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);
这篇关于当共享与Intent.createChooser图像,我的文件消失了!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!