public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate (Resource.Layout.MyEvents, container, false); btnCreateEvent = view.FindViewById<Button> (Resource.Id.btnCreateEvent); eventsListView = view.FindViewById<ListView>(Resource.Id.lstEvents); eventsListView.Adapter = new NetExam.MyEvent_ItemAdapter(this.Activity, items); eventsListView.ItemClick += OnListEventClick; btnCreateEvent.Click += delegate { var fragTx = FragmentManager.BeginTransaction(); var frag = new CreateEventFragment(); fragTx.Replace(Resource.Id.framelayout_maincontainer, frag); fragTx.Commit(); }; return view; }
private void CallFragment(int Id) { var frag =new Android.App.Fragment(); var fragTx = FragmentManager.BeginTransaction(); fragTx.SetCustomAnimations (Resource.Animation.slide_in_left, Resource.Animation.slide_out_right); switch (Id) { case Resource.Id.relativeLayoutcontainerHome: case Resource.Id.relativeLayoutcontainerMyEvents: frag =new MyEventsFragment(); fragTx.Replace(Resource.Id.framelayout_maincontainer, frag); break; case Resource.Id.relativeLayoutcontainerCreateEvent: frag = new CreateEventFragment (); fragTx.Replace (Resource.Id.framelayout_maincontainer, frag).AddToBackStack("CREATEEVENT"); break; case Resource.Id.relativeLayoutcontainerCreateAttendee: frag = new CreateAttendeeFragment (); fragTx.Replace (Resource.Id.framelayout_maincontainer, frag).AddToBackStack("CREATEATTENDEE"); break; case Resource.Id.relativeLayoutcontainerMyAttendees: frag = new MyAttendeesFragment (); fragTx.Replace (Resource.Id.framelayout_maincontainer, frag).AddToBackStack("MYATTENDEES"); break; default: frag =new MyEventsFragment(); fragTx.Add(Resource.Id.framelayout_maincontainer, frag).AddToBackStack("MYEVENTS"); break; } fragTx.Commit(); mDrawerLayout.CloseDrawers (); }