android中一些常用的VIEW动作类型
2010-07-14 17:04
573 查看
// 实例一个intent对象
Intent intent = new Intent();
// 设置动作事件为Action_View;
intent.setAction(android.content.Intent.ACTION_VIEW);
String fileName = file.getName();
if (justFileEndWith(fileName, this.getResources().getStringArray(
R.array.fileEndWithImage))) {
intent.setDataAndType(Uri.fromFile(file), "image/*");
} else if (justFileEndWith(fileName, this.getResources()
.getStringArray(R.array.fileEndWithAudio))) {
intent.setDataAndType(Uri.fromFile(file), "audio/*");
} else if (justFileEndWith(fileName, this.getResources()
.getStringArray(R.array.fileEndWithVideo))) {
intent.setDataAndType(Uri.fromFile(file), "video/*");
}
else if(fileName.endsWith(".apk"))
{
//安装APK文件
intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive");
}
else if(fileName.endsWith(".txt"))
{
intent.setDataAndType(Uri.fromFile(file),"txt/*");
}
this.startActivity(intent);
Intent intent = new Intent();
// 设置动作事件为Action_View;
intent.setAction(android.content.Intent.ACTION_VIEW);
String fileName = file.getName();
if (justFileEndWith(fileName, this.getResources().getStringArray(
R.array.fileEndWithImage))) {
intent.setDataAndType(Uri.fromFile(file), "image/*");
} else if (justFileEndWith(fileName, this.getResources()
.getStringArray(R.array.fileEndWithAudio))) {
intent.setDataAndType(Uri.fromFile(file), "audio/*");
} else if (justFileEndWith(fileName, this.getResources()
.getStringArray(R.array.fileEndWithVideo))) {
intent.setDataAndType(Uri.fromFile(file), "video/*");
}
else if(fileName.endsWith(".apk"))
{
//安装APK文件
intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive");
}
else if(fileName.endsWith(".txt"))
{
intent.setDataAndType(Uri.fromFile(file),"txt/*");
}
this.startActivity(intent);
相关文章推荐
- android view的一些常用触发方法
- Android常用动作广播类别消息类型
- android view的一些常用方法
- android TextView(5)-TextView一些其他常用效果
- android view的一些常用触发方法
- Android——一些常用的自定义View
- android view的一些常用触发方法
- android textView常用功能
- 有关Android的调试时候常用到的一些技巧
- Android中常用的位图操作(View与Bitmap转化、圆角、灰化、提取Alpha、旋转、倒影、剪切……)
- Android基本常用控件的介绍TextView EditText Button Menu
- android(4) 使用ViewPaper 以及这几年来的一些感悟
- Android对ViewGroup中OnMeasure方法的一些个人见解
- Android之常用类型转换
- 整理一些C#中常用的一些类型转换_ts
- 【Android】【Other】Android一些常用命令
- 搜集了一些android intent在程序中的常用的用法
- Android TextView的跑马灯效果以及TextView的一些属性
- Android系统view控件使用的一些坑
- Android常用工具类之界面上的一些工具