Nilesh Tupe
Nilesh Tupe

Reputation: 7803

MIME type for files

I want to handel some files through my application for that i am using following code

Intent intent = new Intent(Intent.ACTION_VIEW);
                            intent.setDataAndType(Uri.fromFile(new File(f.getAbsolutePath() + "/" + fileName)), fileType);
                            startActivity(intent);

i want to handel some files for that i need MIME types of following files

1)Office files(DOC,PPT,XLS,Word etc) 2)VCF 3)AVI,3gp,flv etc 4)APK

please post any if you are knowing...

and plz let me know if there is any other way to handel the files

Thank You..:)

Upvotes: 0

Views: 2715

Answers (2)

Matthew Clark
Matthew Clark

Reputation: 571

1)http://filext.com/faq/office_mime_types.php for the office types. 2)"text/x-vcard" for vcf 3)http://www.w3schools.com/media/media_mimeref.asp and http://filext.com for movies 4)"application/vnd.android.package-archive" for apk files I use filename.endsWith("doc") to figure out the filetype. I know this isn't the most elegant solution, but I can't get that URLConnection.guessContentTypeFromName(String url) to work for me...

Upvotes: 3

Velehto
Velehto

Reputation: 36

I guess you can use URLConnection.guessContentTypeFromName(String url) to find out the MIME type. I've not tested it, but I'll need this too, so I will give it a try.

Upvotes: 2

Related Questions