On May 6, 2013, at 7:42 PM, Paul Johnson <p...@all-the-johnsons.co.uk> wrote: > I've ported the code at > http://androidbite.blogspot.in/2012/10/android-slidingdrawer-example.html (it > was simple enough) and have come up with this > > using System; > > using Android.App; > using Android.Content; > using Android.Runtime; > using Android.Views; > using Android.Widget; > using Android.OS; > > namespace Slider > { > [Activity (Label = "SlidingDraw", MainLauncher = true)] > public class Activity1 : Activity, SlidingDrawer.IOnDrawerCloseListener, > SlidingDrawer.IOnDrawerOpenListener > { > private Button sliderButton; > private SlidingDrawer drawer; > private Context context;
What's `context` for? > protected override void OnCreate(Bundle bundle) > { > base.OnCreate(bundle); > SetContentView(Resource.Layout.Main); > > drawer = FindViewById<SlidingDrawer>(Resource.Id.SlidingDrawer); > sliderButton = FindViewById<Button>(Resource.Id.slideButton); > Button btn1 = FindViewById<Button>(Resource.Id.Button01); > Button btn2 = FindViewById<Button>(Resource.Id.Button02); > Button btn3 = FindViewById<Button>(Resource.Id.Button03); > context = btn1.Context; > > btn1.Click += BtnPressed; > btn2.Click += BtnPressed; > btn3.Click += BtnPressed; > > drawer.SetOnDrawerOpenListener(this); > drawer.SetOnDrawerCloseListener(this); > } > > public void OnDrawerOpened() > { > drawer.AnimateOpen(); The Java sample doesn't use animateOpen(). Perhaps that's partially responsible for your app "going crazy"? > sliderButton.Text = "V"; > } > > public void OnDrawerClosed() > { > drawer.AnimateClose(); The Java sample doesn't use animateClose() either. Ditto. > sliderButton.Text = "^"; > } > > > private void BtnPressed(object s, EventArgs e) > { > Button t = (Button)s; > Toast.MakeText(context, t.Text + " was clicked", > ToastLength.Short).Show(); Use `this` instead of `this.Context`. All Activities are Contexts. > Is this issue mine or a problem in monodroid that needs to go into BZ? I suspect the issue is yours, with the added Animate*() invocations. - Jon _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid