应用内打开文件有时候太麻烦,可以通过调用手机自带软件打开,比如wps、Misrosoft,这样做一是节省了开发时间,二是功能比较多,毕竟人家是专业的。那么如何实现
预览图

/**
* @Description: 打开文件工具类
* @author: ZhangYW
* @time: 2019/1/10 10:52
*/
public class OpenFileUtil {
private static final String[][] MATCH_ARRAY={
//{后缀名, 文件类型}
{
".3gp", "video/3gpp"},
{
".apk", "application/vnd.android.package-archive"},
{
".asf", "video/x-ms-asf"},
{
".avi", "video/x-msvideo"},
{
".bin", "application/octet-stream"},
{
".bmp", "image/bmp"},
{
".c", "text/plain"},
{
".class", "application/octet-stream"},
{
".conf", "text/plain"},
{
".cpp", "text/plain"},
{
".doc", "application/msword"},
{
".docx", "application/msword"},
{
".xls", "application/msword"},
{
".xlsx", "application/msword"},
{
".exe", "application/octet-stream"},
{
".gif", "image/gif"},
{
".gtar", "application/x-gtar"},
{
".gz", "application/x-gzip"},
{
".h", "text/plain"},
{
".htm", "text/html"},
{
".html",


5321

被折叠的 条评论
为什么被折叠?



