Reputation: 3
I am getting when trying to set navigation mode how to resolve it
[Activity(Label = "@string/app_name", MainLauncher = true)]
public class MainActivity : Activity,ActionBar.ITabListener {
private ActionBar ab;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
try{
//here i am getting instance of action bar
ab = ActionBar;
**i am getting error at this line **
ab.NavigationMode = ActionBarNavigationMode.Tabs;
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
}
}
Upvotes: 0
Views: 1499
Reputation: 3338
I ran your code, with the only exception that i did not impliment the ITabListener, and it works.
[Activity (Label = "@string/app_name", MainLauncher = true)]
public class MainActivity : Activity
{
private ActionBar ab;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
try {
//here i am getting instance of action bar
ab = ActionBar;
**i am getting error at this line **
ab.NavigationMode = ActionBarNavigationMode.Tabs;
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
} catch (Exception ex) {
throw ex;
}
}
}
I have never seen someone using an actionbar by implimenting the ITabListener ( on xamarin ). I would sugest you take the xamarin way of building up an actionbar. Here is a link to the documentation.
Upvotes: 2