2015年4月8日 星期三

Android: How to open a specific folder via Intent and show its content in a file browser? (轉貼)

來源:http://stackoverflow.com/questions/17165972/android-how-to-open-a-specific-folder-via-intent-and-show-its-content-in-a-file

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"));
} 



Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory() + "/myFolder/");
 Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(selectedUri, "resource/folder");
 startActivity(intent);

沒有留言:

張貼留言