各样式文件打开
// 打开 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); }