Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Created May 28, 2013 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhameyie/5666887 to your computer and use it in GitHub Desktop.
Save bhameyie/5666887 to your computer and use it in GitHub Desktop.
Tabhost activity
[Activity(Label = "Detail")]
public class DetailActivity : Activity
{
private FakeFashionImageThumbnail m_fakeFashionImageDetail;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Detail);
var tabHost = FindViewById<TabHost>(Resource.Id.detailTabhost);
var localActivityManager = new LocalActivityManager(this, false); //Initializes the local activity needed by the tab host
localActivityManager.DispatchCreate(bundle); // adds the activity bundle the local activity manager
tabHost.Setup(localActivityManager); // this is the crucial line required since the content view that was set for this activity is not a TabHost
var spec = tabHost.NewTabSpec("comments");
spec.SetIndicator("Comments");
var intent = new Intent(this, typeof(CommentTab));
intent.AddFlags(ActivityFlags.NewTask);
spec.SetContent(intent);
tabHost.AddTab(spec);
spec = tabHost.NewTabSpec("Recommendations");
spec.SetIndicator("Recommendation (s)");
intent = new Intent(this, typeof(RecommendationTab));
intent.AddFlags(ActivityFlags.NewTask);
spec.SetContent(intent);
tabHost.AddTab(spec);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment