我目前在我的应用中使用getExternalCacheDir()
下载了一个文件,并与其他应用共享(电子邮件作为附件,whatsapp等)。
它工作正常,但我不确定这是否是正确的方法。
答案 0 :(得分:1)
您可以在应用目录中保存本地文件并使用共享意图。可能这个解决方案可以提供帮助:
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri file = Uri.parse(path);
sharingIntent.setType("*/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, file);
startActivity(Intent.createChooser(sharingIntent, "Share file"));
所有此类文件操作仅适用于应用程序。但是,http://developer.android.com/reference/android/content/Context.html#getExternalCacheDir%28%29可以提供帮助