topical media & game development
#mobile-application-12-DerbyNames-MonoAndroid-DerbyNames-MonoAndroid-Main.cs / cs
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using System.Collections.Generic;
namespace DerbyNames_MonoAndroid
{
[Activity (Label = "DerbyNames", MainLauncher = true)]
public class Main : Activity
{
VixenTab m_vixenTab = new VixenTab();
LeaugeTab m_leaugeTab = new LeaugeTab();
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
AddVixenTab ("Vixens");
AddLeagueTab ("Teams");
}
private void AddVixenTab (string tabText)
{
var tab = this.ActionBar.NewTab ();
tab.SetText ("Vixens");
tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) {
m_vixenTab = new VixenTab();
e.FragmentTransaction.Add (Resource.Id.fragmentContainer, m_vixenTab);
e.FragmentTransaction.Remove(m_leaugeTab);
};
this.ActionBar.AddTab (tab);
}
private void AddLeagueTab (string tabText)
{
var tab = this.ActionBar.NewTab ();
tab.SetText ("Teams");
tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) {
m_leaugeTab = new LeaugeTab();
e.FragmentTransaction.Add (Resource.Id.fragmentContainer, m_leaugeTab);
e.FragmentTransaction.Remove(m_vixenTab);
};
this.ActionBar.AddTab (tab);
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.