protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); userID = Intent.GetStringExtra ("id") ?? "-1"; mainPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); mainEditor = mainPrefs.Edit (); serviceNumer = mainPrefs.GetInt ("service_size", -1); SetContentView (Resource.Layout.Main); tabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); tabHost.Setup (); for (int i = 1; i <= 2; i++) { TabHost.TabSpec tabSpec; tabSpec = tabHost.NewTabSpec("Tab " + i); tabSpec.SetIndicator("Tab " + i); tabSpec.SetContent(new FakeContent(this)); tabHost.AddTab(tabSpec); } tabHost.SetOnTabChangedListener(this); viewPager = FindViewById<ViewPager> (Resource.Id.view); var adaptor = new ServiceBeaconAdapter (SupportFragmentManager); adaptor.addFragmentView ((i, v, b) => { var view = i.Inflate (Resource.Layout.Page, v, false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = myText.Text + "1"; return view; }); adaptor.addFragmentView((i,v,b) => { var view = i.Inflate(Resource.Layout.Page,v,false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = myText.Text + "2"; return view; }); viewPager.Adapter = adaptor;//new ServiceBeaconAdapter (SupportFragmentManager); viewPager.SetOnPageChangeListener(this); beaconStatusLabel = FindViewById<TextView> (Resource.Id.beaconStatusLabel); beaconMgr.Bind (this); //myProcessedBeacons = new JavaDictionary<string,string>(); monitorNotifier.EnterRegionComplete += EnteredRegion; monitorNotifier.ExitRegionComplete += ExitedRegion; rangeNotifier.DidRangeBeaconsInRegionComplete += HandleBeaconsInRegion; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); userID = Intent.GetStringExtra ("id") ?? "-1"; mainPrefs = GetSharedPreferences("loginPrefs",FileCreationMode.Private); mainEditor = mainPrefs.Edit (); serviceNumer = mainPrefs.GetInt ("service_size", -1); categoryNumber = mainPrefs.GetInt ("category_size", 0); SetContentView (Resource.Layout.Main); tabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); tabHost.Setup (); for (int i = 0; i < categoryNumber; i++) { TabHost.TabSpec tabSpec; tabSpec = tabHost.NewTabSpec(mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower()); tabSpec.SetIndicator(mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower()); tabSpec.SetContent(new FakeContent(this)); tabHost.AddTab(tabSpec); } tabHost.SetOnTabChangedListener(this); setSelectedTabColor (); /*for(int i = 0; i < tabHost.TabWidget.ChildCount; i++) { View v = tabHost.TabWidget.GetChildTabViewAt(i); // Look for the title view to ensure this is an indicator and not a divider. v.SetBackgroundResource(Resource.Drawable.apptheme_tab_indicator_holo); }*/ viewPager = FindViewById<ViewPager> (Resource.Id.view); var adaptor = new ServiceBeaconAdapter (SupportFragmentManager); for (int i = 0; i < categoryNumber; i++) { adaptor.addFragmentView ((k, v, b) => { var view = k.Inflate (Resource.Layout.Page, v, false); var myText = view.FindViewById<TextView> (Resource.Id.textView1); myText.Text = mainPrefs.GetString ("ServiceCategoriesName_" + i, null).ToLower(); return view; }); } viewPager.Adapter = adaptor;//new ServiceBeaconAdapter (SupportFragmentManager); viewPager.SetOnPageChangeListener(this); beaconStatusLabel = FindViewById<TextView> (Resource.Id.beaconStatusLabel); beaconMgr.Bind (this); //myProcessedBeacons = new JavaDictionary<string,string>(); monitorNotifier.EnterRegionComplete += EnteredRegion; monitorNotifier.ExitRegionComplete += ExitedRegion; rangeNotifier.DidRangeBeaconsInRegionComplete += HandleBeaconsInRegion; }