예제 #1
0
		public override global::Android.Support.V4.App.Fragment GetItem (int position)
		{
			switch (position) 
			{
			case 0:
				SearchMakeFragment mf = new SearchMakeFragment ();
				mf.setListener (this);
				return mf;
			case 1:
				SearchYearFragment yf = SearchYearFragment.newInstance (mYears);
				yf.setListener (this);
				return yf;
			case 2:
				SearchPartFragment pf = SearchPartFragment.newInstance (mParts);
				pf.setListener (this);
				return pf;
			}
			return fragments [position];
		}
		private string[] searchString = new string[3]; //0: make, 1: year, 2: part

          protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.ViewPagerActivity);

               //Step 1: Create the all of the Search fragments
               SearchMakeFragment fragment = new SearchMakeFragment();
               SearchYearFragment fragment2 = new SearchYearFragment();
               SearchPartFragment fragment3 = new SearchPartFragment();
               
               //Step 2: Make their listeners this Activity.
               fragment.setListener(this);
               fragment2.setListener(this);
               fragment3.setListener(this);

               //Step 3: Add the Activities to the proper fragment of the ViewPagerActivity.
               global::Android.Support.V4.App.FragmentTransaction transaction = SupportFragmentManager.BeginTransaction();
               transaction.Add(Resource.Id.frame_container, fragment);
               transaction.Add(Resource.Id.frame_container2, fragment2, "year");
               transaction.Add(Resource.Id.frame_container3, fragment3, "part");
               transaction.Commit();
		
		}
		private string[] searchString = new string[4]; //0: make, 1: year, 2: part

          protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
               RequestWindowFeature(WindowFeatures.NoTitle);
			SetContentView (Resource.Layout.ViewPagerActivity);

               SearchMakeFragment fragment = new SearchMakeFragment();
               SearchYearFragment fragment2 = new SearchYearFragment();
               SearchPartFragment fragment3 = new SearchPartFragment();
               
               fragment.setListener(this);
               fragment.Arguments = Intent.Extras;
               fragment2.setListener(this);
               fragment2.Arguments = Intent.Extras;
               fragment3.setListener(this);
               fragment3.Arguments = Intent.Extras;

               global::Android.Support.V4.App.FragmentTransaction transaction = SupportFragmentManager.BeginTransaction();
               transaction.Add(Resource.Id.frame_container, fragment);
               transaction.Add(Resource.Id.frame_container2, fragment2, "year");
               transaction.Add(Resource.Id.frame_container3, fragment3, "part");
               transaction.Commit();
		
		}