View action for non-standard file types

File Manager/Explorer for Android devices.
Post Reply
tidosho
Posts: 1
Joined: Tue Jul 16, 2013 4:23 pm
AntiSpam sum: 8

View action for non-standard file types

Post by tidosho »

Hi there:

I have written an app that handles ACTION_VIEW intents for KML files, based on path patterns (see below) but clicking on a KML file just raises an error dialog (Error - cannot open file). Is this because you look up the MIME type to create an ACTION_VIEW intent? And don't have KML in your registry? Or is there something wrong with my Intent filter?

You can use the PackageManager to check whether any Activities can handle a simple URI-based intent, so as to avoid crashes (and circularities, i.e. AndExplorer calling itself).

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:pathPattern=".*\\.kml" />
<data android:host="*" />
</intent-filter>

Regards,

Martin

support
Posts: 833
Joined: Sun Apr 20, 2008 4:40 pm

Re: View action for non-standard file types

Post by support »

Yes, it's because KML is not our registry.

Post Reply