|
hi guys
I create action bar for android application using c#.net.
my code is:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Directory.InitializeDirectory();
ActionBar bar = ActionBar;
mActionBarView = LayoutInflater.Inflate(Resource.Layout.action_bar_custom, null);
ActionBar.SetCustomView(mActionBarView, new ActionBar.LayoutParams(WindowManagerLayoutParams.WrapContent, WindowManagerLayoutParams.WrapContent));
var tab1 = ActionBar.NewTab();
tab1.SetText("Login");
tab1.SetTabListener(actionbarInterface);
bar.AddTab(bar.NewTab().SetText("Login").SetTabListener(actionbarInterface));
bar.CustomView = mActionBarView;
bar.DisplayOptions = ActionBarDisplayOptions.ShowCustom | ActionBarDisplayOptions.UseLogo;
bar.NavigationMode = ActionBarNavigationMode.Tabs;
bar.SetDisplayShowHomeEnabled(true);
tab1.TabSelected += delegate
{
TitlesFragment titleFrag = (TitlesFragment)FragmentManager.FindFragmentById(Resource.Id.frag_title);
titleFrag.PopulateTitles(tab1.Position);
titleFrag.SelectPosition(0);
};
but in line tab1.SetTabListener(actionbarInterface)has error Unhandled Exception:
Java.Lang.IllegalStateException
plz help me.
|
|
|
|
|
Please edit your question and:
- Format your code by putting <pre> tags around it.
- Give the complete text of the exception message, or modify your code to catch it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
my code is :
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Directory.InitializeDirectory();
ActionBar bar = ActionBar;
mActionBarView = LayoutInflater.Inflate(Resource.Layout.action_bar_custom, null);
ActionBar.SetCustomView(mActionBarView, new ActionBar.LayoutParams(WindowManagerLayoutParams.WrapContent, WindowManagerLayoutParams.WrapContent));
var tab1 = ActionBar.NewTab();
tab1.SetText("Login");
tab1.SetTabListener(actionbarInterface);
bar.AddTab(bar.NewTab().SetText("Login").SetTabListener(actionbarInterface));
bar.CustomView = mActionBarView;
bar.DisplayOptions = ActionBarDisplayOptions.ShowCustom | ActionBarDisplayOptions.UseLogo;
bar.NavigationMode = ActionBarNavigationMode.Tabs;
bar.SetDisplayShowHomeEnabled(true);
The full text of the error is
Unhandled Exception:Java.Lang.IllegalStateException
.
|
|
|
|
|
It would seem that you may be calling some method before the application is ready to process it: see here[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
how to create action bar for android application using c#?
|
|
|
|