【问题标题】:How to create intent activity with file pick dialog?如何使用文件选择对话框创建意图活动?
【发布时间】:2016-11-14 00:19:33
【问题描述】:

更确切地说,如何创建活动,然后如何使用选定的路径写入可移动存储?

Like this, and this?

【问题讨论】:

    标签: android android-external-storage


    【解决方案1】:

    首先您需要为提示创建自定义对话框。然后调用意图打开特定文件夹。见下面的代码。

     Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory() + "/myFolder/");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(selectedUri, "resource/folder");
    
    if (intent.resolveActivityInfo(getPackageManager(), 0) != null)
    {
        startActivity(intent);
    }
    else
    {
        // if you reach this place, it means there is no any file 
        // explorer app installed on your device
    }
    

    对于自定义对话框Material Design Dialog Lib

    【讨论】:

      猜你喜欢
      • 2013-02-03
      • 1970-01-01
      • 1970-01-01
      • 2014-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      相关资源
      最近更新 更多