如彩信、Email、Gmail、网站等添加附件,如果应用本身没有做文件浏览选择的功能,此时应用可以通过发送ACTION_GET_CONTENT的系统接口来获取其他具备浏览选择文件功能的应用来支持该功能,比如此时添加附件会弹出一个选择框,有图库、音乐播放器等,现在如果想让FM也支持,在AndroidMenifest.xml中添加如下配置:
<intent-filter>
<action andriod:name="android.intent.action.GET_CONTENT"/>
<category android:name="android.intent.category.OPENABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimetype="*/*"/>
</intent-filter>
在点击Item打开File的时候添加如下代码:
String action=mContext.getIntent().getAction();
if(!TextUtils.isEmpty(action)&&action.equals(Intent.ACTION_GET_CONTENT)){
Uri uri=getDbUriFromFilepath(mContext,filepath);
//从数据库中查询该物理路径对应的Uri
if(uri!=null){
intent.setDataAndType(uri,type);
}else{
intent.setDataAndType(Uri.fromFile(new File(filepath)),type);
}
mContext.setResult(Activity.RESULT_OK,intent);
mContext.finish();
return;
}
分享到:
相关推荐
this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } activity_main: <LinearLayout xmlns:android=...
<TextView android:id="@+id/example_row_tv_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textSize="18sp" /> 这个布局...
获取系统图片的简单示例,使用Intent.ACTION_GET_CONTENT 和 MediaStore两种方式获取图片以及其真正的系统所在的位置
从手机相册中选择一幅图片并显示在屏幕上 */ public class MainActivity extends AppCompatActivity { private Button btn_choose; private ImageView img_show; private final int REQUEST_PICTURE_CHOOSE = 1...
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <script type="text/javascript" src="jquery-1.8.0.min.js"></script> <form action="a2.php" name="form1" method="post"> 姓名: 年龄:...
在论坛里看到一篇 "MapView和其它控件一起显示 " 的帖子, 那是很老的一篇帖子了, 很多朋友都说无法在android SDK 1.0上运行。既然那么多人关心,我在这里就把它重写一遍,顺便加入了一些新的功能 ,感兴趣的朋友可以...
form action=”action.php” method=”post” > <input type=”text” name=”userName” id=”userName” /> <input type=”text” name=”user...php$raw_post_data = file_get_contents(‘php:
android用于打开各种文件的intent
Android的Intent.ACTION_GET_CONTENT Windows Windows.Storage.Pickers 需要Android 5.0以上版本和iOS 10以上版本 安装 npm i --save react-native-document-picker OR yarn add react-native-document-picker ...
主要原因是android从4.4版本开始通过intent.ACTION_GET_CONTENT打开选择器后,getData()返回的URI没有包含真实的文件路径,而是像这样“content://com.android.providers.media.documents/document/image:1234”,以...
前言 最近在工作的过程中,遇到不同 Android 版本下 URI 采用不同方式...intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(image/*); startActivityFor
Intent getImage = new Intent(Intent.ACTION_GET_CONTENT); getImage.addCategory(Intent.CATEGORY_OPENABLE); getImage.setType(MIME_TYPE_IMAGE_JPEG); startActivityForResult(getImage, ACTIVITY_GET_IMAGE);...
switch (event.getAction()) { case MotionEvent.ACTION_DOWN: start_date = new Date(); this.listening = true; this.rec.start(); break; case MotionEvent.ACTION_UP: Date end_date = new...
define(‘MAGIC_QUOTES_GPC’, function_exists(‘get_magic_quotes_gpc’) && get_magic_quotes_gpc());//获取是否开启了自动转义 define(‘ICONV_ENABLE’, function_exists(‘iconv’));//iconv函数是否存在 ...
import android.content.Context; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics...
Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT); galleryIntent.addCategory(Intent.CATEGORY_OPENABLE); galleryIntent.setType("image/png"); startActivityForResult(galleryIntent, 1);...
What is TedBottomPicker? In Google's Material Design, Google introduce Bottom ...Get image from gallery(using Intent.ACTION_PICK intent) Get image from recent image(using MediaStore.Images.Media.EXTE
return (List<Content>) super.getData(params, env); } } @Override protected boolean isPage() { return false; } } Content_list.html中的内容 [#list tag_list as a] <li><a href="${a.url}" ...
java lru leetcode interview-question-collection 算法 leetcode n个整数的无序数组,找到每个元素后面比它大的第一个数,要求时间复杂度为O(N) ...简述Android的View绘制流程,Android的wrap_content是
The content of the web is maturing and increasing in complexity, but internet infrastructure quality varies widely across the globe. People are browsing the web through a greater variety of devices ...