I have a launcher activity which contains two tabs which corresponds to two separate activities HeatMap
and LiveMkt
.
As I read somewhere one can not use following statement in child activities:
Window.RequestFeature(WindowFeatures.CustomTitle);
So I tried following....
OnCreate()
of Launcher activity contains :
base.OnCreate (bundle);
Window.RequestFeature(WindowFeatures.CustomTitle);
SetContentView(Resource.Layout.TabView);
//Code to create tabs which points to two activities `HeatMap` and `LiveMkt`
OnCreate()
of LiveMkt
contains :
base.OnCreate (bundle);
SetContentView(Resource.Layout.LiveMkt);
Window.SetFeatureInt(WindowFeatures.CustomTitle,Resource.Layout.TitleBar);
edsearch = (EditText) FindViewById(Resource.Id.edsearch);
_autoSearchBox = new AutoSearchBox();
_autoSearchBox.LoadSearchBox(this,edsearch,lsym);
where AutoSearchBox
class has LoadSearchBox()
which contains
public void LoadSearchBox(Activity activity,EditText edsearch,ListView lsym)
{
edsearch.TextChanged+= delegate
{//Something
}
}
But when I debugged this, I get NullPointerException
in LoadSearchBox()
for edsearch
and lsym
even though I have these two elements in LiveMkt
and passing them to LoadSearchBox()
.
LiveMkt.xml
contains ListView
lsym and TitleBar.xml
contains EditText
edsearch.
StackTrace:
Exception Details : System.NullReferenceException: Object reference not set to an instance of an object
at AutoSearchBox.LoadSearchBox (Android.App.Activity activity, Android.Widget.EditText edsearch, Android.Widget.ListView lsym)
As I'm new to Mono Android, any help appreciated.