开发者

problem with (manifest) package name and R class when linking in source

开发者 https://www.devze.com 2023-04-01 09:13 出处:网络
i have 2 applications whose manifest package name is com.x and com.y. both applications use a certain set of java classes so in each application project

i have 2 applications whose manifest package name is com.x and com.y.

both applications use a certain set of java classes so in each application project i link in a source folder in which these common java files are. these java files use R class, for menus, for example i have R.menu.page1_menu referenced in a common java fi开发者_开发百科le.

so now my problem is this:

when i build the first application whose package is com.x the generator produces com.x.R class and that's what i need to import it into the java files that use R. and when i build the second appl'n the generator produces com.y.R and since my common java code contains imports for com.x.R i need to go and change all these common files again to import the right file.... this is cumbersome. i know i can solve the problem by each appl extending the class hierarchy or by using factories, but...

is there a way to control the target class into which a given menu is generated? for example my page1_menu.xml could contains an attribute that tells the generator to generate data into com.x.and.y.R and then my common code imports that and it works for both applications... in other words if this attribute is not used the default target is .R class but if the attribute is used, use that target...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号