Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I need get MimeType for extension using this method. (Show intent to open file.)
It works good 1-2 times - I can see a correct list of available apps, but after that it begins return null.
At the same time MimeTypeMap.Singleton.HasExtension return true.
Device is Motorolla Xoom, but another app work fine and show a correct list of available apps.
And one addition - if i get not null mimetype I see intent with available apps - 2 apps, but another application propose another list - 4 apps.
var file = new Java.IO.File(TemporaryFilePath);
var targetUri = Android.Net.Uri.FromFile(file);
var extension = MimeTypeMap.GetFileExtensionFromUrl (targetUri.ToString());
var mimeType = MimeTypeMap.Singleton.GetExtensionFromMimeType(extension);
Intent openIn = new Intent (Intent.ActionView);
openIn.SetDataAndType (targetUri, mimeType);
Hi! Any luck?
I believe that this is an API usage issue, not a binding issue. As such I'm not sure where to start.
Please provide a complete, self-contained, reproducible test case that demonstrates the problem. (Even better would be the corresponding Java app which is "the same" but exhibits different behavior.)
> var file = new Java.IO.File(TemporaryFilePath);
> var targetUri = Android.Net.Uri.FromFile(file);
> var extension = MimeTypeMap.GetFileExtensionFromUrl (targetUri.ToString());
> var mimeType = MimeTypeMap.Singleton.GetExtensionFromMimeType(extension);
This code doesn't make sense. `extension` will be a file extension, e.g. ".p3", yet you're passing it to MimeTypeMap.GetExtensionFromMimeType(), which will want a mime-type, not an extension.
For example, MimeTypeMap.Singleton.GetExtensionFromMimeType("mp3") returns null, as "mp3" isn't a mime-type.
MimeTypeMap.Singleton.GetExtensionFromMimeType("video/mpeg"), meanwhile, returns "mpga".
My mess. Closed.