views:

32

answers:

1

Register to be able to open files of custom type. Say i have .cool files, and if the user tries to oepn it, Android asks if they would like to open it with my application. How?

+1  A: 

I think that you don't choose that. This is handle by the system. Same thing when you send an intent to be handled by a map, If you have skyfire for instance, the system pops up a window an you can choose the application and choose if you want it to always open this kind of file.
Unless of course if your application is the only one to open this kind of file.

Edit
I think if you want your app to say "hey I'm able to open these .cool files", you need to set up <intent-filters> with a tag <data> and specificy the mimeType or Uri. Check here for more details.

Sephy
He is asking how to specify that his application can handle a filetype.
alexanderblom
true, I added some stuff.
Sephy
Can I please have a full working example?
Aymon Fournier
The manifest part, and also starting the activity, and retrieving the file from someone selecting my application
Aymon Fournier
I don't have time now to right and test something. Try to do it please, I'll have a look later if I have time.
Sephy
do I get extras from intent?
Aymon Fournier
I told you, I don't know right now, I have to run some tests and code. I'm not using that all the time.
Sephy
Meh I figured it out
Aymon Fournier
Did my advice help you dig in the right direction?Sorry I've been on the train all day...
Sephy