[英]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. 我有一个
CustomListActivity
,我希望公开同一数据的两个方面。
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
: 这些将根据我的
ContentProvider
mimetype进行过滤:
org.acme.cars.cursor.dir/colors org.acme.cars.cursor.dir/models org.acme.cars.cursor.dir /颜色org.acme.cars.cursor.dir /模型
My CustomListActivity
is quite involved, but general enough to be re-used, but: 我的
CustomListActivity
涉及很多,但是足够通用,可以重复使用,但是:
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? 我可以在AndroidManifest.xml中声明两个活动,每个活动具有相同的类,对其进行参数化吗?还是需要从该类内部使用某些开关?
为什么不将其保留为单个活动,将布局保留在单独的XML文件中,并使用setContentView在它们之间进行切换?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.