How do I parameterize an Activity from within AndroidManifest.xml
I have a CustomListActivity
which I wish to expose two facets of the same data.
For example: I have a list of cars, and would like to list the set of colors, and the set of models. These would be filtered on mimetype from my ContentPr开发者_如何学JAVAovider
:
org.acme.cars.cursor.dir/colors org.acme.cars.cursor.dir/models
My CustomListActivity
is quite involved, but general enough to be re-used, but:
- the user should be able to swap between the two lists from a menu/button bar
- the list is MAIN LAUNCHER intent.
- the user's choice of facet (model or color) should be remembered
- we should be able to call these activities via mimetype.
So, my question is:
Can I declare two activities in the AndroidManifest.xml, each one with the same class, parameterizing it, or do I need to use some switch from within the class?
Why not keep it a single activity, keep the layouts in separate XML files, and use setContentView to switch between them?
精彩评论