I have an activity defined as: public class FlipperDemo extends Activity { @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); } }
With this in main.xml <?xml version="1.0" encoding="utf-8"?> <com.test.MyFlipper xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" /> MyFlipper.java contains class MyFlipper extends View { public MyView( Context context, AttributeSet attrs ) { super( context, attrs ); ViewFlipper flipper1 = (ViewFlipper) LayoutInflater.from ( context ).inflate( R.layout.myflipper, null ); ViewFlipper flipper2 = (ViewFlipper) findViewById ( R.id.flipper ); } } And myflipper.xml contains <?xml version="1.0" encoding="utf-8"?> <ViewFlipper xmlns:android="http://schemas.android.com/apk/res/ android" android:id="@+id/flipper" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <Button android:id="@+id/button2" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </ViewFlipper> The problem is that in the MyView() constructor flipper1 gets set, but flipper2 is null! Why cant i get flipper by Id here?
-- 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