I am new to xamarin android I have given up on forms and I am wanting to change layout onnavigationselecteditem
and was wondering if someone can point me in right direction I tried using setContentView
but that did not change the view at all.
There has been a layout created with the name of jobs so i no its not null I wish people would stop flagging questions with a general null statment its not the case here.
public bool OnNavigationItemSelected(IMenuItem item)
{
int id = item.ItemId;
if (id == Resource.Id.nav_camera)
{
// Handle the camera action
}
else if (id == Resource.Id.jobs)
{
SetContentView(Resource.Layout.jobs);
}
else if (id == Resource.Id.nav_assignjob)
{
}
else if (id == Resource.Id.nav_manage)
{
}
else if (id == Resource.Id.nav_share)
{
}
else if (id == Resource.Id.nav_send)
{
}
DrawerLayout drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
drawer.CloseDrawer(GravityCompat.Start);
return true;
}
It timed out with the following
Unhandled Exception:
System.NullReferenceException:
On the drawer.CloseDrawer(GravityCompat.Start);
line I presume because
SetContview
left something open but didn't display it.