Android custom categories

Posted by marian on Stack Overflow See other posts from Stack Overflow or by marian
Published on 2010-04-21T07:33:00Z Indexed on 2010/04/21 7:43 UTC
Read the original article Hit count: 555

Filed under:
|

Hello, I have a view as a main screen of the application which contains the available application's actions as icon+text pairs ( desktop like).

I want to find out programatically what are the activities defined ONLY in my AndroidManifest.xml

Suppose I have : < activity android:name="example.mainActivity" android:label="mainActivity">
< intent-filter>
< action android:name="android.intent.action.MAIN" />
< category android:name="android.intent.category.LAUNCHER" />
< /intent-filter>
< /activity>
< activity android:name="example.activity1" android:label="Activity1">
< intent-filter>
< action android:name="android.intent.action.VIEW" />
< category android:name="example.custom.ACTIVITY" />
< /intent-filter>
< /activity>
< activity android:name="example.activity2" android:label="Activity2">
< intent-filter>
< action android:name="android.intent.action.VIEW" />
< category android:name="example.custom.ACTIVITY" />
< /intent-filter>
< /activity>

I want that in the mainActivity to dinamically read Activity1 and Activity2 because when i add Activity3 for example it will be automatically read.

I thought that this could be done by defining a custom category, example.custom.ACTIVITY, and in the mainActivity use the packageManager.queryIntentActivities(Intent intent, int flags) but it doesn't seem to be working.

I really would like to code it to dinamically discover the installed activities in my application. Do you have any ideas on how to do this? Thank you

© Stack Overflow or respective owner

Related posts about android-manifest

Related posts about android