c# 4.0 - error showing when i try to add tab to my android application -


I am getting this error when I compile the code Error CSX 2020: non-static field, for a method Object reference is required, or property 'Android. Widget.TabHost.NewTabSpec (string)'

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; Using Android. App; Using Android. material; Using Android .OS; Using Android. From time to time; Using Android. See; Using Android.Widget; Namespace Employee Directory Android {{Activity (label = "Tabs layout disabled", main Lenin = true, icon = "@ drawable / IC_Luncher")) Public square tab layout: activity {Uncredited (bundle bundle) without secure override {base.OnCreate (bundle); SetContentView (Resources. Layout.TabsLayout); CreateTab (type (calendar activity), "calendar", "calendar", resource.Drawable. Calendar); Make the tab (typef (hospital academy), "closest hospital", "closest hospital", resource. Drawable hospital); CreateTab (Type (MapActivity), "Map and Location", "Map and Location", Resources. Drawable.maps); CreateTab (typef (anxietyactivity), "exercise", "exercise", resource. Drawable. Accessor); CreateTab (typef (dietactivity), "diet", "diet", resource. Drawable.edit); // Create your application here: Private Zero CreateTab (type activity type, string tag, string label, int drawableId) {var = new intent (this, activity type); Intent.AddFlags (ActivityFlags.NewTask); Var spec = TabHost.NewTabSpec (tag); Var drawableIcon = Resources.GetDrawable (drawableId); Spec.SetIndicator (label, drawableIcon); Spec.SetContent; TabHost.AddTab (idea); Selvin said in the form of the 

}

}

You should get the context of your tabhost and then call your (example) method NewTabSpec, like:

  TabHost th = FindViewById & lt; TabHost & gt; (Resource.ind.matabhab); Var spec = th.NewTabSpec (tag);    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -