Friday, November 6, 2009

[android-developers] Re: Building your own UI library like the embeddable Google Maps library

Check out the Maven android plugin: http://code.google.com/p/maven-android-plugin/

I haven't tried it yet, but I believe you can include other android
projects with their own R class. Note that you'll have to make sure
that none of the R values match. For example, you can't have a
drawable named icon in each project, they'll have to have different
names.

On Nov 6, 12:29 am, Edward Falk <ed.f...@gmail.com> wrote:
> OK, how about this related issue?
>
> I wrote a utility class that I want to use in multiple products.
>
> org.efalk.gridbox.GridBox   <= my utility class
> org.efalk.rpncalc.RpnCalc   <= product that I want to use Gridbox
>
> The Gridbox class looks like:
>
> package org.efalk.gridbox;
>   ...
>   private void GridboxInit(Context ctx, AttributeSet attrs)
>   {
>     if( attrs != null ) {
>       TypedArray a = ctx.obtainStyledAttributes(attrs,
> R.styleable.Gridbox);
>       innerMargin =
>         a.getDimensionPixelSize(R.styleable.Gridbox_inner_margin,
> innerMargin);
>       gravity = a.getInt(R.styleable.Gridbox_gravity, gravity);
>     }
>   }
>
> This code fails to compile with "R cannot be resolved"
>
> How can I get R to resolve?  I can make it all work by moving my
> GridBox class into the same directory as my main program and renaming
> everything appropriately, but that defeats the purpose of having a
> single .java file which I can use in more than one application.
>
> Are there any examples out there of somebody creating a custom View
> class and putting it into a different directory from R.java?

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