protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            base.OnListItemClick(l, v, position, id);

            // Create an intent to signal what we intent to do, IE. Open TrainingRoomDetailActivity from MainActivity
            Intent intent = new Intent(this, typeof(TrainingRoomDetailActivity));
            // Get the selected TrainingRoom from the ListAdapter
            TrainingRoom selectedItem = ((ArrayAdapter <TrainingRoom>)ListAdapter).GetItem(position);

            // Add extra information to the intent (The room id)
            intent.PutExtra("roomId", selectedItem.Id);
            // Navigate to the TrainingRoomDetailActivity
            StartActivity(intent);
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.TrainingRoomDetail);

            // Get ID from intent
            int roomID = Intent.GetIntExtra("roomId", 0);
            // Create a repo and get the specified room
            RoomRepository repo = new RoomRepository();
            TrainingRoom   room = repo.GetRoom(roomID);

            // Set data
            this.Title = "Room Detail";
            this.FindViewById <TextView>(Resource.Id.txtName).Text     = room.Name;
            this.FindViewById <TextView>(Resource.Id.txtLocation).Text = room.Location;
        }