如何使用任何文件资源管理器发送选择ttf文件的意图? [英] How to send an intent to select ttf file with any file explorer?

查看:139
本文介绍了如何使用任何文件资源管理器发送选择ttf文件的意图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在按下按钮时发送一个意图,为此,我想通过从设备中安装的文件资源管理器列表中选择它来打开文件资源管理器...(使用使用以下操作完成操作:") 然后,使用该文件浏览器选择一个ttf文件作为我的textview的settypeface.问题是,我发现了与MIME类型文件有关的内容,但是我不明白...任何人都可以告诉我该怎么做? ;)

i want to send an intent when pressing a button, with this intent i want to open a file explorer by selecting it from a list of file explorers installed in device...(using "Comlete action with: ") Then, with that file explorer select a ttf file to settypeface of my textview.. The question is , i have found something related to MIME type files, but i dont understand it... Anyone can tell me how to do this, please? ;)

我不得不说,为了设置字体,我认为我需要一个带有文件路径的字符串.

I have to say that, for setting typeface, i think i need a string with file path.

推荐答案

MIME类型是您要查找的内容的说明.例如,JPEG图像将具有图像/jpeg"类型.至于TTF文件,尽管没有正式注册的MIME类型,但最常用的(根据Wikipedia)是

The Mime type is a description of the content you're looking for. For example, a JPEG image will have a "image/jpeg" type. As for TTF files, although there is no officially registered MIME type, the most commonly used (according to Wikipedia) is

application/x-font-ttf

关于意图的文档使用 ACTION_GET_CONTENT 给出了一个示例行动.这是使用方法:

The documentation on Intents give an example using an ACTION_GET_CONTENT action. here's how you could use it :

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("application/x-font-ttf");
startActivityForResult(intent,PICKFILE_RESULT_CODE);

这篇关于如何使用任何文件资源管理器发送选择ttf文件的意图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆