Hello,
i try to place a second layout in my project. But how do i access the button
on the second Layout? i tried this:

                protected override void OnCreate(Bundle bundle)
                {
                        base.OnCreate(bundle);

                        // Set our view from the "main" layout resource
                        SetContentView(Resource.Layout.Layout1);

                        // Get our button from the layout resource,
                        // and attach an event to it
                        Button button = 
FindViewById<Button>(Resource.Id.Button1);
                        button.Click += delegate { 
SetContentView(Resource.Layout.Layout2); };
                        
                        Button button2 = 
FindViewById<Button>(Resource.Id.Button2);
                        button2.Click += delegate { 
SetContentView(Resource.Layout.Layout1); };
                }

but he stops at 
button2.Click += delegate { SetContentView(Resource.Layout.lala); };
with NullReference Exception...
Button1 is on layout1 and button2 is on layout2...




--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Two-Layouts-tp5711258.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to