I don't think there is any point in setting the values before the constructor. I can't think of a situation where you would want to do that.
Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com On Wed, Apr 6, 2011 at 2:47 PM, Mike Bear <[email protected]> wrote: > I want to set the value before the constructor MyView, so then the view > instance is not ready yet. > My plan is to set the value in attributes in MyActivity, and then in the > constructor of MyView, the attributes will be used. > > The problem is how to set the value of custom attributes in MyActivity, > before the view is constructed. > > > > On Wed, Apr 6, 2011 at 5:07 PM, Kumar Bibek <[email protected]> wrote: > >> Expose methods in your custom view that activities can call directly. >> >> Kumar Bibek >> http://techdroid.kbeanie.com >> http://www.kbeanie.com >> >> >> >> On Wed, Apr 6, 2011 at 2:35 PM, Mike Bear <[email protected]>wrote: >> >>> I defined the XML file and attributes, and can read the values from the >>> attributes. >>> But still there is another issue, >>> How can I set the values in MyActivity? >>> >>> Thanks, >>> Mike >>> >>> On Wed, Apr 6, 2011 at 2:37 PM, Zsolt Vasvari <[email protected]>wrote: >>> >>>> Use custom attributes in the layout XML. You can declare them in >>>> attrs.xml. >>>> >>>> On Apr 6, 1:48 pm, "[email protected]" <[email protected]> >>>> wrote: >>>> > Hello Guys, >>>> > >>>> > I defined a customer view, e.g. MyView, which need to be constructed >>>> > with some own parameter, e.g. line number in the view, an integer. >>>> > The view will be employed by my activity, MyActivity. >>>> > It seems that the View's constructors are fixed and will be called by >>>> > the system, and I can do nothing on it. >>>> > >>>> > The question is: >>>> > How to pass the integer to the view during construction from >>>> > the activity, while I've known the integer in MyActivity? >>>> > >>>> > Thanks in advance. >>>> > Mike >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" 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-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 [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-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 [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-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 [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-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 [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-developers?hl=en

