android - How to get MimeType from Camera? -


I am going with my surface visual camera activation from which I want to get the file MimeTye While calling the Uri gallery of the local route, the material can get the mime type from Uri, but the MimeType can not be used to convert the locuspath into the content URI for loading the camera, because it is tried below Was:

  the public A stable Uri getImageContentUri (REFERENCES, file imageFile) {string filePath = imageFile.getAbsolutePath (); Cursor cursor = context.getContentResolver (). Query (MediaStore.Emages.medical.example.com), New String [] {MediaStore.Images.Media._ID}, MediaStore.Media.DATA + "=?", New String [] {FilePath}, Faucet); If (cursor! = Null & amp; cursor.metotfest ()) {int id = cursor.getInt (cursor .getColumnIndex (MediaStore.MediaColumns._ID)); // URI baseURI = Uriper's (string Yuri); Return Uri.withAppendedPath (uploadImageURI, "+ id);} Else {if (imageFile.exists ()) {ContentValues ​​value = new ContentValues ​​(); Values.put (MediaStore.Images.Media.DATA, filePath) ; Return context.getContentResolver () .inert (MediaStore.Images.Media.EXTERNAL_CONTENT_URI, value);} and {return null;}}}   

this link has been deleted: but The problem is not fixed.

To solve this problem, there is another solution to solve this. If you have a URI then you can get the MIME type

/ blockquote>

or URI URI = URI.framefile (file); ContentResolver CR = context.getContentResolver (); string mime = / P>

// url = Try the file path or whatever URL you want. public static string matchtip (string url) {string type = Null; string extension = mime typemap .getFileExtensionFromUrl (url); If (extension! = Zero) {MimeTypeMap mime = MimeTypeMap.getSingleton (); Type = mime.getMimeTypeFrom extension (extension); } Return type; }

For more information

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -