public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); linearLayout = new LinearLayout(Activity); ListView l = new ListView(Activity); l.Adapter = new TrainingAdapter(SharedPrefsSaver.GetTrainingFromPreferences()); linearLayout.AddView(l); return(linearLayout); }
private void StopTraining() { //Organiseer de layout voor Opnieuw Starten LayoutToStart(); // niet meer aan het trainen inTraining = false; // stop de timer timer.Stop(); //Reset de Timer en de Stopwatch ResetTimer(); stopWatchText.Text = "00:00:00"; //Clear de Map googleMap.Clear(); // Verberg de stopwatch en afstand masterLayout.RemoveView(bottomLayout); // Alert voor save training EditText e = new EditText(Activity); DateTime d = DateTime.Now; e.Text = "Training op " + d.ToShortDateString(); Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(Activity); dialog.SetView(e); dialog.SetMessage("Do you want to name your training?"); dialog.SetPositiveButton("Save", delegate { // Hernoem de training naar de waarde van de EditText training.Name = e.Text; // Sla training op m.b.v. SharedPrefSaver Class SharedPrefsSaver.SaveTraining(training); }); dialog.SetNegativeButton("Don't Save", delegate { }); dialog.Show(); }