0

Possible Duplicate:
Android intent filter: associate app with file extension

I've associated an XML file with extensions .x to my application. I would like to click on .x file, my associated application should start, and I would like to open the file, passed in some way, from inside onCreate() of activity. There is a way to do this ?

Thanks in advance.

0

1 Answer 1

0

Add this intent filter in your manifest to your activity

<intent-filter>
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <data android:mimeType="application/xml" />
 <data android:pathPattern=".*\\.x" />
</intent-filter>

on your onCreate files are passed on as:

Uri uri = this.getIntent().getData();
if(uri!=null){
 Log.v(getClass().getSimpleName(), "importing uri:"+uri.toString());
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.