Created
May 28, 2013 23:18
-
-
Save bhameyie/5666887 to your computer and use it in GitHub Desktop.
Tabhost activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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