尝试打开一个特定的文件夹中使用意向的android [英] Trying open a specific folder in android using intent
本文介绍了尝试打开一个特定的文件夹中使用意向的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Android中打开特定文件夹?是否可以打开一个特定的文件夹????这是code I M使用
配置=(按钮)findViewById(R.id.btn_cf);
config.setOnClickListener(新View.OnClickListener()
{
@覆盖
公共无效的onClick(视图v)
{
意向意图=新的意图(Intent.ACTION_GET_CONTENT);
开放的我们的uri = Uri.parse(MNT / SD卡/ myfiles的/ allfiles /下载);
intent.setDataAndType(URI,* / *);
startActivity(Intent.createChooser(意向,下载));
}
});
解决方案
公共无效openFolder()
{
意向意图=新的意图(Intent.ACTION_GET_CONTENT);
开放的我们的uri = Uri.parse(Environment.getExternalStorageDirectory()。getPath()
+/ MyFolder的/);
intent.setDataAndType(URI,文/ CSV);
startActivity(Intent.createChooser(意向,打开文件夹));
}
这是其他的MIME类型,比如* / *
也是可以的。
I am trying to open a specific folder in android ?Is it possible to open a specific folder ???? this is the code i m using
config=(Button)findViewById(R.id.btn_cf);
config.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent("Intent.ACTION_GET_CONTENT");
Uri uri = Uri.parse("mnt/sdcard/myfiles/allfiles/download");
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "download"));
}
});
解决方案
public void openFolder()
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ "/myFolder/");
intent.setDataAndType(uri, "text/csv");
startActivity(Intent.createChooser(intent, "Open folder"));
}
An other MIME type like "*/*"
is also possible.
这篇关于尝试打开一个特定的文件夹中使用意向的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文