protected override void OnCreate(Bundle bundle) {
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
// Get our button from the layout resource,
// and attach an event to it
_myButton = FindViewById<Button>(Resource.Id.myButton);
_myButton.Click += delegate {
_myButton.Text = string.Format("{0} clicks!", _count++);
};
var pref = this.GetPreferences(FileCreationMode.Private);
_count = pref.GetInt("main_activity_click_count", _count);
_myButton.Text = pref.GetString("main_activity_button_text", "Nothing in state.");
}