Sunday, June 12, 2011

Re: [android-developers] Creating a view in java

The Context / AttributeSet constructor is used when a view is inflated from XML.
 
For creating a view {subclass} from code, you can make any constructor that makes sense - it should be passed a Context, most likely won't have an AttributeSet (since that comes from XML), and can have any other parameters as necessary.
 
-- Kostya

2011/6/12 TreKing <trekingapp@gmail.com>
On Fri, Jun 10, 2011 at 12:16 PM, c0dege3k <c0dege3k@gmail.com> wrote:
I have a class in my app that extends View, and I need to pass in the
Context and AttributeSet parameters, but I don't know what to use. So,
IS there a way to make a view without using the findViewById method?

Your question does not make a ton of sense. You should elaborate.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices


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

No comments:

Post a Comment