getMime

fun getMime(uri: Uri): String?

Return the MIME type of the given URI.

Parameters

uri
  • URI of the file


fun getMime(path: String): String?

Return the MIME type based on the file path. This function first attempts to determine the MIME type based on the URI. If that fails, it falls back to determining the MIME type based on the file extension.

Parameters

path
  • the file path as a string


fun getMime(file: File): String?

Return the MIME type based on the File object. This method tries to determine the MIME type using the ContentResolver for URIs, and if that fails, it falls back to using MimeTypeMap with the file extension.

Parameters

file
  • the file object