开发者

How to list the data types that android application operates with?

In the scenario that I made up a user chooses an application and and I offer him/her the available pieces of data to operate on.

For example:

  • if the user chooses to open a pdf reader application - I want to offer him the available .pdf files?

  • or if the user select some music player I want to offer him the music files he/she has stored.

I agree that it is a strange use-case, but I got pretty curious about it.

I know that the possible data type for an application is specified in its manifest file and I suppose that this information is available, but I have some difficulty finding out what the data content type for 开发者_如何学Goapplication is?


I'm not sure exactly what you mean by data content type for an application. Applications are released as APKs.

When you wish to open up a pdf or other type of file a broadcast is sent to the system. In this broadcast is an intent and that intent stores the action and the data type of its content (including the content or path to it). The system then looks through all the IntentFilters for an application that claims it can perform the given action on the given data type. If there are several it than asks you to store the preference.

On the other hand, if you are trying to find all the pdf files, than you don't you scan the storage to all files ending in .pdf

Does this answer your questions?


Nope, :) not at all.

I'm aware of how android handles a requiest for opening a particular file.

What I want is exactly vice-versa!

For example - the user says I want to open MyPDFReader app. and I ask him/ her: - ok - you have one.pdf and two.pdf available - would you like to open some of them with MyPDFReader, or you will start it without pre-selected pdf file?

and that information I'll put in the intent to call MyPDFReader.

But before I offer files for opening to the user - I have to know which (what type of) files to seek for, because it would be inappropriate to ask the user whether he/she would like to start their PDF reader app with an .mp3 file

in fewer words - Is it possible to find what is the content data type that an application can start with and if you, friends, please - can you give me a clue how to sort it (the content data type) out?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜