标题有点长,不多说
Intent intent=new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("text/plain");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent,REC_REQUESTCODE);
其中“text/plain”是文件的后缀名所对应的MIME类型
当指定两种或两种以上指定文件类型格式是:
//intent.setType("video/*;image/*");//同时选择视频和图片
随手贴上常用的MIME类型
//{后缀名,MIME类型}
{
".3gp", "video/3gpp"},
{
".apk", "application/vnd.android.package-archive"},
{
".asf", "video/x-ms-asf"},
{
".avi", "video/x-msvideo"},
{
".bin", "application/octet-stream"},
{
".bmp", "image/bmp"},
{
".c", "text/plain"},
{
".class", "application/octet-stream"},
{
".conf", "text/plain"},
{
".cpp", "text/plain"},
{
".doc", "application/msword"},
{
".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
{
".xls", "application/vnd.ms-excel"},
{
标题有点长,不多说
Intent intent=new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("text/plain");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent,REC_REQUESTCODE);
其中“text/plain”是文件的后缀名所对应的MIME类型
当指定两种或两种以上指定文件类型格式是:
//intent.setType("video/*;image/*");//同时选择视频和图片
随手贴上常用的MIME类型
//{后缀名,MIME类型}
{
".3gp", "video/3gpp"},
{
".apk", "application/vnd.android.package-archive"},
{
".asf", "video/x-ms-asf"},
{
".avi", "video/x-msvideo"},
{
".bin", "application/octet-stream"},
{
".bmp", "image/bmp"},
{
".c", "text/plain"},
{
".class", "application/octet-stream"},
{
".conf", "text/plain"},
{
".cpp", "text/plain"},
{
".doc", "application/msword"},
{
".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
{
".xls", "application/vnd.ms-excel"},
{