【问题标题】:open directory from a notification bar从通知栏打开目录
【发布时间】:2016-02-21 08:24:33
【问题描述】:

我正在后台从 Url 下载文件并在通知中显示过程,并且下载的文件正在存储到下载的文件夹中,我想在用户点击通知栏时打开下载文件夹(目录),我该怎么做做这个 ??这是我尝试过的,但它没有做任何事情,即使在 logcat 中没有错误:

DownloadFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(DownloadFolder), "file/*");
PendingIntent contentIntent = PendingIntent.getActivity(context, id, intent,
        PendingIntent.FLAG_UPDATE_CURRENT);

下载文件夹是安卓下载目录的路径,不知道我做错了什么,因为我不知道,任何指导都会对我很有帮助

谢谢

【问题讨论】:

  • 文件夹打开,但点击文件,它没有打开。有什么解决办法吗?

标签: java android android-intent notifications


【解决方案1】:

试试这个意图操作:intent.setAction(Intent.ACTION_GET_CONTENT);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-05
    相关资源
    最近更新 更多