在我的应用程序中我有ListActivity中显示的文件列表现在我想添加额外的选项,如windows :(打开文件夹位置)打开该文件的目录我测试一些代码但不工作抛出异常:
File file=new File(path);
Uri url = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(url);
startActivity(intent);
exeption:
03-08 21:14:55.451: E/AndroidRuntime(15708):
android.content.ActivityNotFoundException: No Activity found to handle Intent {
act=android.intent.action.VIEW dat=file:///storage/extSdCard/Bluetooth }
我能做什么?
答案 0 :(得分:0)
public void openFolder()
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ "/Bluetooth /");
intent.setDataAndType(uri);
startActivity(Intent.createChooser(intent, "Open folder"));
}