How to open files in Android with default viewer using jCIFS

随声附和 提交于 2019-12-07 01:37:06

问题


I'm using the free jCIFS library to connect to my NAS device via CIFS, and it's working great. I can connect and get a list of filenames, etc. without any issues.

Now I'd like to open one of the files in the default Android application - i.e. a music file should be opened in the music player, an image in the gallery, video file in a video player and so forth. The issue is not really about getting the MIME type and so on. The issue is that I don't want to download the files first, they should be streamed.

Does anyone know how this can be achieved? I know that CifsManager (another third party application) is capable of doing something similar, but it doesn't use jCIFS and it requires root access to mount drives. It is essential that my application doesn't require root access.

You can find the jCIFS library here: http://jcifs.samba.org/


回答1:


You can use the SmbFileInputStream to read the file.
Please go through the documentation jcifs.smb.SmbFileInputStream



来源:https://stackoverflow.com/questions/8030769/how-to-open-files-in-android-with-default-viewer-using-jcifs

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