【问题标题】:How to tell what's the MIME type according to the file?如何根据文件判断 MIME 类型是什么?
【发布时间】:2011-05-23 21:22:53
【问题描述】:

是否有任何优雅的方式(不仅仅是if ("fileExt".compareTo(".mp3")) {MIME_TYPE = "audio/*"})以编程方式学习应该放入意图中的 MIME 类型,我必须用它打开文件?

谢谢!

【问题讨论】:

    标签: android file types android-intent mime


    【解决方案1】:

    它和你的 if 语句一样,但更优雅

    使用 MimeTypeMap 类

    http://developer.android.com/reference/android/webkit/MimeTypeMap.html

    【讨论】:

      【解决方案2】:

      【讨论】:

        猜你喜欢
        • 2012-04-16
        • 2011-07-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-09
        • 2011-04-19
        相关资源
        最近更新 更多