Tuesday, June 15, 2010

Re: [android-developers] Change Default Package Name of R.java

I looked into Library Projects, but I am not sure if that helps me. I assume I would put the Activity in the library, since it is what is used by each "app". However, that Activity relies on String values from res/values/strings. Each "app" will have different strings. Therefore the activity calls R.string.something to get the string from the resource.

In order to make each app its own unique app, I need to change the "package" attribute of <manifest> element in the AndroidManifest.xml. This has the unfortunate side effect of generating the R class with the app's custom package name. Therefore, when the Activity common code base tries to look up a string using the R class, it cannot find the class since it has a different package name.

At this point I am thinking about creating an Ant target to replace the package name in R.java. However, I feel like there has to be a better way.

Am I overlooking something? Can this be accomplished with libraries? 


On Tue, Jun 15, 2010 at 10:00 AM, Mark Murphy <mmurphy@commonsware.com> wrote:
On Tue, Jun 15, 2010 at 9:47 AM, Jeff <jeff.thorn@gmail.com> wrote:
> Any other suggestions?

Try the new "library project" featured added in the latest edition of
the dev tools:

http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject
http://developer.android.com/guide/developing/other-ide.html#libraryProject

--
Mark Murphy
CommonsWare
mmurphy@commonsware.com
http://commonsware.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate