I have an android app in which the user should be able to tap a file and it should provide options/chooser which lists the possible apps that can play/view the content.
So without hardcoding it as a music/video/pdf or whatever , is there a way to dynamically let the suitable app play the file because the file extension could be anything.
Thanks,
Supply the MIME type of the file in the
Intentyou use withstartActivity(), and Android will supply a chooser automatically if appropriate.It is up to you to find a suitable MIME type. The
android.webkit.MimeTypeMaputility class can help with this, for some common MIME types. You can also save the MIME type when you downloaded the file from the Web server, if applicable.