Oh, I see, when I use new Button(getContext(), attrs), where attrs are got from one of the overloaded constructors, then everything is all right.. What makes it impossible to create button simply with new Button (getContext()) ?
On 16 авг, 18:04, ff <[email protected]> wrote: > Hi! I've created custom compound component and observe very strange > exception (google says nothing about it). > It is very simple: > > public class MyTabber extends LinearLayout { > .. > public MyTabber(Context context) { > super(context); > Init(context);} > > ..+2 overloads > Button x = null; > public void Init(Context context) > { > x = new Button(getContext()); > addView(x); // exception seems to be here > > } > > The layout where I use the component is also simple and has the > following occurense: > <com.roma.second.MyTabber xmlns:android="http://schemas.android.com/ > apk/res/android" > id="@+id/yes" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > /> > > When I try to edit layout (in visual representation) - I get: > > [2009-08-16 17:59:48 - main.xml] Parser is not a BridgeXmlBlockParser! > java.lang.NullPointerException > at android.view.ViewGroup.addView(ViewGroup.java:1661) > at android.view.ViewGroup.addView(ViewGroup.java:1648) > at com.roma.second.MyTabber.Init(MyTabber.java:49) > at com.roma.second.MyTabber.<init>(MyTabber.java:31) > > Please advice... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

