android - 我的 android 应用程序如何找到从 PC 下载的文件?
问题描述
我将文件从 PC 上传到我的 android 手机。我想从应用程序中打开此文件。在网上可以找到许多示例代码,但在我的环境中都没有。该应用程序提出了几个可以处理此意图的应用程序,但它们都显示了一个空的下载目录。我的代码是:
Intent intent = new Intent();
intent.setAction(DownloadManager.ACTION_VIEW_DOWNLOADS);
try {
startActivityForResult(
Intent.createChooser(intent, "Select a File to Upload"),
FILE_SELECT_CODE);
} catch (android.content.ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
Toast.makeText(this, "Please install a File Manager.",
Toast.LENGTH_SHORT).show();
}
已设置 READ_EXTERNAL_STORAGE 和 WRITE_EXTERNAL_STORAGE 权限。
有任何想法吗 ?
解决方案
推荐阅读
- python - 如何在 tkinter 中更改多个级别的 windows 图标?
- javascript - Js过滤条件如果存在
- sql - Hue impala中的SQL创建函数语法错误
- c# - 没有 AllowSynchronousIO=true 的流 zip 文件
- c# - C# Winforms - 读取 csv 文件的问题
- javascript - 使用 tocbot 时如何修复 CSS 网格中的标题和侧边栏
- javascript - 使用 p5.js 在图像上摆动形状
- python - Google 上传某些文件失败
- elasticsearch - 在 Fluentd 中查找上次缓冲区刷新的时间戳
- java - 如何在freemarker中使用保留字符(#)作为插值