如何在按钮单击时从存储卡打开文件夹

时间:2014-02-20 09:18:01

标签: android android-button

我想打开名为'Songs'的文件夹,这是在按钮点击的sd卡中创建的..请任何人帮我这样做

open.setOnClickListener(new OnClickListener() 
  {

        @Override
        public void onClick(View arg0)
          {
           Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
           Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "Songs");
           intent.setDataAndType(uri);
           startActivity(Intent.createChooser(intent, "Open"));
         }

1 个答案:

答案 0 :(得分:1)

试试这个:

public void Folder()
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
    + "/Songs/");
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open"));
}