[mono-android] mono-android-9794
Jonathan Pryor
jpryor at novell.com
Mon Mar 14 22:22:25 EDT 2011
On Mar 14, 2011, at 3:00 AM, Asmaa Mohamed Roushdy wrote:
> After installing new version mono-android-9794
> I had error in my code
...
I assume that you were getting compiler errors, not runtime errors (as those look like compiler errors...). On that assumption...
>
> // Initialize a TabSpec for each tab and add it to the TabHost
> spec = TabHost.NewTabSpec("MyListView");
TabHost.NewTabSpec(string) is an instance method:
http://docs.monodroid.net/index.aspx?link=M%3aAndroid.Widget.TabHost.NewTabSpec(System.String)
You appear to be attempting to call it as a static method, hence the compiler error. You would instead need to do:
TabHost host = new TabHost(this); // assuming inside Activity...
TabHost.TabSpec spec = host.NewTabSpec ("MyListView");
> spec.SetIndicator("ListView", Resources.GetDrawable(Resource.Drawable.ic_tab));
> spec.SetContent(intent);
> TabHost.AddTab(spec);
Similarly, TabHost.AddTab(TabHost.TabSpec) is an instance method, not a static method:
http://docs.monodroid.net/index.aspx?link=M%3aAndroid.Widget.TabHost.AddTab(Android.Widget.TabHost.TabSpec)
As such, you need to call it on an instance:
host.AddTab(spec);
- Jon
More information about the Monodroid
mailing list