How to create intent activity with file pick dialog?

喜夏-厌秋 提交于 2019-12-25 04:23:18

问题


More exactly, how to create activity and then how to use selected path to write to removable storage?

Like this, and this?


回答1:


First you need to create Custom Dialog for Hint. then call intent to open specific Folder. see below code.

 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
}

For custom Dialog Material Design Dialog Lib



来源:https://stackoverflow.com/questions/40575914/how-to-create-intent-activity-with-file-pick-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!