> Just to wrap up this thread for posterity so anyone in the future  who
> trips across it in a search will actually find something final and
> applicable, here's how I got it working (Mark's reply wasn't quite the
> ticket apparently).

There are a few ways of achieving this sort of integration. I took a
guess, since I've never heard of Linda File Manager, let alone used it.

> The relevant code from NotePad's manifest is the following activity
> entry:
>
>         <activity android:name="NotesList" android:label="@string/
> title_notes_list">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category
> android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>             <intent-filter>
>                 <action android:name="android.intent.action.VIEW" />
>                 <action android:name="android.intent.action.EDIT" />
>                 <action android:name="android.intent.action.PICK" />
>                 <category
> android:name="android.intent.category.DEFAULT" />
>                 <data android:mimeType="vnd.android.cursor.dir/
> vnd.google.note" />
>             </intent-filter>
>             <intent-filter>
>                 <action
> android:name="android.intent.action.GET_CONTENT" />
>                 <category
> android:name="android.intent.category.DEFAULT" />
>                 <data android:mimeType="vnd.android.cursor.item/
> vnd.google.note" />
>             </intent-filter>
>         </activity>
>
> In particular, the second intent-filter is the golden ticket, i.e.,
> when a user taps a file in Linda File Manager and gets a list of apps,
> is that second intent-filter which makes NotePad appear in the list of
> options.

I fail to see the value in having, say, Notepad show up if the tapped-upon
file is, say, an MP3 file. But, again, I have not used Linda File Manager
and so may be misunderstanding it.

Regardless, they may be using queryIntentActivityOptions() on
PackageManager to find applications, which does not rely upon the
ALTERNATIVE or SELECTED_ALTERNATIVE categories. My apologies for being
incorrect in my original guess.

> Incidentally, I discovered that w.r.t. Linda File
> Manager, the exact action which is being triggered is VIEW (note that
> it isn't ACTION_VIEW, it's VIEW, which makes sense given that it is
> prefixed with "android.intent.action.").

ACTION_VIEW is the constant declared by the Intent class in Java. ACTION_
gets converted to android.intent.action. when declaring the action in an
<intent-filter> clause.

> Also, as far as I can tell,
> the right way to access the actual file once your app has been fired
> up in onCreate() is to access the activity's intent's data string as a
> file URI, thus:
>
>       public void onCreate(Bundle savedInstanceState) {
>               String uriStr = getIntent().getDataString();
>       }
>
> Now you can parse the URI, get a path, and presumably open a file.
> Maybe it isn't the right way to do it, but it's certainly *A* way to
> do it.

No, that should be pretty much correct.

> Also, the value of mimeType, although presumably important as a
> filter, doesn't play any role in this process as far as I can tell.

I would consider that a flaw in Linda File Manager, but, again, I have not
used it.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to