But my activity never explicitly calls the view's constructor.  The
activity simply calls:

setContentView( R.layout.main );

in its onCreate() method, and the custom view is specified in the
main.xml.

I think the constructor is called when the device is booted.   Is
there another way to set the content view explicity?



On Oct 28, 1:48 pm, "Mark Murphy" <mmur...@commonsware.com> wrote:
> > Would you have to use instanceof to find out if the context was the
> > activity?
>
> At least once in development, to confirm that your View's Context is an
> Activity.
>
> If you're concerned about the Context's underlying type changing -- and
> it's not an unreasonable concern -- then you're better served holding your
> own reference to the Activity. That's fairly cheap, and if you require an
> Activity in the constructor, you eliminate all doubt.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to