Thanks for your reply John P.  I think you are right.... if I want to use an
inner class and reference it in XML then it needs to be static.  That much
makes sense now (not sure exactly what I was thinking at the time)... :)

And I was wrong about the Dev Guide.  It doesn't mention different ways of
referencing them when they are static or not, just whether or not they are
nested.

However, there is still the issue that when I make my inner class static, I
still can't reference it from the XML file...  I tried making it static
after the suggestion was made, and it resulted in a NoSuchMethodException.
For some reason it can't find my constructor that takes both a Context and
an AttributeSet even though it exists and is public.

Thanks,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Sun, Sep 20, 2009 at 11:00 AM, John P. <[email protected]> wrote:

>
> > But I still think his inner class should be static (as in the
> > document) because to instantiate an inner non-static class, you'd
> > first need the super class object
>
> sorry, *outer* class, not 'super' class ...
>
> On Sep 20, 12:53 pm, "John P." <[email protected]> wrote:
> > He's taking the inner class route, and yes he does provide the full
> > path to the class according to his first post.
> >
> > But I still think his inner class should be static (as in the
> > document) because to instantiate an inner non-static class, you'd
> > first need the super class object; whereas to instantiate an inner
> > static class, you can just instantiate it.  I'd be very impressed if
> > Android's XML layout can handle both cases.  =)
> >
> > On Sep 20, 12:43 pm, martin-g ml <[email protected]> wrote:
> >
> > > Did you provide the full name of the class ?
> >
> > > Something like <com.mycompany.RunningTaskGallery> ?
> >
> > > El dom, 20-09-2009 a las 09:57 -0600, Justin Anderson escribió:
> >
> > > > Making it static doesn't change anything, except that I get the
> > > > following again:
> >
> > > > 09-19 22:04:09.824: ERROR/AndroidRuntime(2716): Caused by:
> > > > java.lang.NoSuchMethodException: RunningTaskGallery
> > > > (Context,AttributeSet)
> >
> > > > The constructor that takes a Context and an AttributeSet does indeed
> > > > exist and it calls the parent's constructor.  Both my class and
> > > > constructors are public.
> >
> > > > However, accodring to the Dev Guide documentation it shouldn't matter
> > > > if it is static or not.  In fact, it gives an alternative way to
> > > > reference it if it is static, but states that you can use either
> > > > approach.
> >
> > > > In my particular case I do not want it to be static.
> >
> > > > Thanks,
> > > > Justin
> >
> > > >
> ----------------------------------------------------------------------
> > > > There are only 10 types of people in the world...
> > > > Those who know binary and those who don't.
> > > >
> ----------------------------------------------------------------------
> >
> > > > On Sun, Sep 20, 2009 at 9:29 AM, John P. <[email protected]>
> > > > wrote:
> >
> > > >         Maybe it should be static, like the NotePad example has in
> > > >
> http://developer.android.com/guide/samples/NotePad/src/com/example/an...
> >
> > > >            public static class LinedEditText extends EditText { ...
> >
> > > >         On Sep 20, 10:19 am, Justin Anderson <
> [email protected]>
> > > >         wrote:
> > > >         > It is a public non-static class.
> >
> > > >         > Thanks,
> > > >         > Justin
> >
> > > >         > On Sep 20, 2009 1:11 AM, "skink" <[email protected]> wrote:
> >
> > > >         > On Sep 19, 8:13 am, MagouyaWare <[email protected]>
> > > >         wrote: > However,
> > > >         > this results in: java.l...
> > > >         > and what about its visibility? is it public?
> >
> > > >         > pskink
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to