views:

66

answers:

2

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 ContentProvider:

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?

A: 

Why not keep it a single activity, keep the layouts in separate XML files, and use setContentView to switch between them?

RickNotFred
This also preserves the notion of multiple views of a single model.
RickNotFred
A: 

The metadata tag may be of interest...

This blog post gives an indication how to access it, though only Application level elements. It remains to be seen if Activity level elements can be accessed in the same way.

jamesh