protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); int taskID = Intent.GetIntExtra("TaskID", 0); if (taskID > 0) { task = TodoItemManager.GetTask(taskID); } // set our layout to be the home screen SetContentView(Resource.Layout.TaskDetails); nameTextEdit = FindViewById <EditText>(Resource.Id.NameText); notesTextEdit = FindViewById <EditText>(Resource.Id.NotesText); saveButton = FindViewById <Button>(Resource.Id.SaveButton); // TODO: find the Checkbox control and set the value doneCheckbox = FindViewById <CheckBox>(Resource.Id.chkDone); doneCheckbox.Checked = task.Done; // find all our controls cancelDeleteButton = FindViewById <Button>(Resource.Id.CancelDeleteButton); // set the cancel delete based on whether or not it's an existing task cancelDeleteButton.Text = (task.ID == 0 ? "Cancel" : "Delete"); nameTextEdit.Text = task.Name; notesTextEdit.Text = task.Notes; // button clicks cancelDeleteButton.Click += (sender, e) => { CancelDelete(); }; saveButton.Click += (sender, e) => { Save(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); int taskID = Intent.GetIntExtra("TaskID", 0); if (taskID > 0) { task = TodoItemManager.GetTask(taskID); } // set our layout to be the home screen SetContentView(Resource.Layout.TaskDetails); nameTextEdit = FindViewById <EditText>(Resource.Id.NameText); notesTextEdit = FindViewById <EditText>(Resource.Id.DateText); saveButton = FindViewById <ImageButton>(Resource.Id.SaveButton); // TODO: find the Checkbox control and set the value doneCheckbox = FindViewById <CheckBox>(Resource.Id.chkDone); doneCheckbox.Checked = task.Done; // find all our controls cancelDeleteButton = FindViewById <Button>(Resource.Id.CancelDeleteButton); // set the cancel delete based on whether or not it's an existing task cancelDeleteButton.Text = (task.ID == 0 ? "Cancel" : "Delete"); nameTextEdit.Text = task.Name; //notesTextEdit.Text = task.Date; // button clicks cancelDeleteButton.Click += (sender, e) => { CancelDelete(); }; saveButton.Click += (sender, e) => { Save(); }; spinner = FindViewById <Spinner> (Resource.Id.priority); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.priority, Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; }