简体   繁体   中英

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 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?

为什么不将其保留为单个活动,将布局保留在单独的XML文件中,并使用setContentView在它们之间进行切换?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM