android 打开各种文件(setDataAndType) 博客分类: android-->非界面 android 打开各种文件 setDataAndType action动作  转自:http://luhuajcdd.iteye.com/blog/1560225 和 http://www.2cto.com/kf/201201/117389.html Java代码  /** * 打开文件 * @param file */ private void openFile(File file){   …
android 打开各种文件(setDataAndType) private void openFile(File file){ Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //设置intent的Action属性 intent.setAction(Intent.ACTION_VIEW); //获取文件file的MIME类型 String type = getMIMEType(file)…
1. Android 打开各种文件(setDataAndType) private void openFile(File file){ Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //设置intent的Action属性 intent.setAction(Intent.ACTION_VIEW); //获取文件file的MIME类型 String type = getMIMEType(fi…
import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.net.Uri.Builder; import java.io.File; import android.content.Intent; //自定义android Intent类, //可用于获取打开以下文件的intent //PDF,PPT,WORD,EXCEL,CHM,HTML,TEXT,AUDI…
很简单,通过调用系统的intent,我们可以打开各种文件,不熟悉的朋友可以了解下action.datatype.uri的相关知识. 通用方法如下: public static Intent openFile(String filePath){ File file = new File(filePath); if(!file.exists()) return null; /* 取得扩展名 */ String end=file.getName().substring(file.getName().l…
android intent打开各种文件的方法   1./**  * 检测是否安装了某个软件  *   * @param pkgName "com.bill99.kuaishua"  * @param mContext  * @return  */ public static boolean isPkgInstalled(String pkgName, Activity mContext) {  PackageInfo packageInfo = null;  try {   pack…
Android下可以打开一些文件,带有.doc 等后缀的文件网上一般都有解释,这个写一个使用文件管理器打开指定文件夹的 private void openAssignFolder(String path){ File file = new File(path); if(null==file || !file.exists()){ return; } Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(…
转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左边的Project中,会自动的定位到当前文件所在的目录.但是在Android Studio中不会自动定位了. 那在Android Studio如何快速的定位到我当前打开的文件在哪个目录下,如图,我打开了MyActivity文件,这个文件在一长串的目录下,但是左边project栏并没有定位到我当前文件…
转载地址:点击打开 这是一个简单的只有3个按钮的程序,3个按钮分别对应三种工作的模式(保存.打开和文件夹选择).封装的SimpleFileDialog.java的内容如下: package com.example.test; /* * * This file is licensed under The Code Project Open License (CPOL) 1.02 * http://www.codeproject.com/info/cpol10.aspx * http://www.c…
转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左边的Project中,会自动的定位到当前文件所在的目录.但是在Android Studio中不会自动定位了. 那在Android Studio如何快速的定位到我当前打开的文件在哪个目录下,如图,我打开了MyActivity文件,这个文件在一长串的目录下,但是左边project栏并没有定位到我当前文件…