开发者

Android: open file dialog

In my app (simple sd card files browser) i开发者_StackOverflow want to open file in the same way thet the standart system files browser do, calling the dialog with list of diffrent applications thet can open or execute this file. I already have file name.


There is no "standart system files browser" in Android.

Assuming that you know the name and MIME type of the file, you can create an ACTION_VIEW Intent, using setDataAndType() to supply the Uri to the file and the MIME type. Then, call startActivity() on that Intent. If the user has chosen a default activity to apply to this type of file, or if there is only one activity that can view the file, then the activity will start. Otherwise, the user will get a "chooser" to allow a choice from the various possible activities.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜