Hi,
I'm trying to change the filepicker (FilePicker-Plugin-for-Xamarin-and-Windows) intent to only show me db files, I thought that if I passed the correct mime-type it would only show me the db files.
I tried several mime-types associated with .db files (sqlite) and none worked, so I tried to get the mime type like this:
string extension = MimeTypeMap.GetFileExtensionFromUrl(filedata.FilePath); string mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
And mimeType is set to null.
This is the code I want to change (FilePickerActivity.cs):
Am I doing something stupid?
Thanks for the help,
Luís Pinho
Answers
when you run this, and breakpoint it - what is the run-time value of
extension
?Hi CLientStLaurent
db
I just checked the code:
https://android.googlesource.com/platform/libcore/+/android-cts-6.0_r26/luni/src/main/java/libcore/net/MimeUtils.java
No db mime type...
So you have your answer then? The extension is db and there is no db mime type. Is that right?
Does this mean that I've got no way to filter by db? Strange...
I have no idea what you're doing with mimetype with respect to your application.
But as for filtering... Sure you can filter by db... You have it right there in the
extension
property.What the worst case? Two pass filtering? First pass takes out everything that was found by mimetype then second pass filters out of those results any extensions you want to drop.