How to send an intent to select ttf file with any file explorer?

前端 未结 1 705
面向向阳花
面向向阳花 2021-01-22 07:53

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 \"Com

相关标签:
1条回答
  • 2021-01-22 08:14

    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
    

    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);
    
    0 讨论(0)
提交回复
热议问题