zoukankan      html  css  js  c++  java
  • 各样式文件打开

        // 打开
        private void OpenFile() {
    
            m_pDialog.cancel();
    
            String end = fileName.substring(fileName.lastIndexOf(".") + 1,
                    fileName.length()).toLowerCase();
    
            Intent intent = new Intent(Intent.ACTION_VIEW);
    
            if (end.equals("jpg") || end.equals("gif") || end.equals("png")
                    || end.equals("jpeg") || end.equals("bmp")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "image/*");
    
            } else if (end.equals("doc") || end.equals("docx")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "application/msword");
    
            } else if (end.equals("xls") || end.equals("xlsx")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "application/vnd.ms-excel");
    
            } else if (end.equals("ppt") || end.equals("pptx")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "application/vnd.ms-powerpoint");
    
            } else if (end.equals("chm")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "application/x-chm");
    
            } else if (end.equals("tif")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "image/tiff");
    
            } else if (end.equals("txt")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "text/plain");
    
            } else if (end.equals("pdf")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "application/pdf");
    
            } else if (end.equals("zip")) {
    
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "application/zip");
            } else {
                intent.setDataAndType(
                        Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory() + "/wzh/",
                                fileName)), "*/*");
            }
    
            startActivity(intent);
        }
  • 相关阅读:
    make menuconfig出错需要安装文件
    编译内核,配置内核make menuconfig
    busbox编译出错,arm-linux-未找到命令
    screen命令
    Shell系列
    ExtJS清除表格缓存
    ExtJS发送POST请求 参数格式为JSON
    ExtJS实现分页grid paging
    ExtJS错误解决 Cannot read property 'on' of undefined
    解决com.mongodb.MongoException$CursorNotFound: cursor 0 not found on server
  • 原文地址:https://www.cnblogs.com/chhom/p/5048796.html
Copyright © 2011-2022 走看看