ColletJb wrote: > I have already developed some widgets for android, but every time, I > have the same problem... I Can' access my XML layout's elements from > my java code. > > For example : > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:layout_width="fill_parent" > android:layout_height="fill_parent"> > > <TextView > android:id="@+id/myTxt" > android:Text="HelloWorld !" > android:layout_width="wrap_content" > android:layout_height="wrap_content" /> > > </LinearLayout> > > With this layout, how can I access my "myTxt" object ? > > Thank you for your help > > ColletJb > > PS : In an Activity, the equivalent is "findViewById(int)".
Use findViewById(), but first rename your widget so that its android:id does not used mixed case. Use all lowercase, perhaps with underscores. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need help for your Android OSS project? http://wiki.andmob.org/hado --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

