public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.Home, container, false); LogInModule lg = new LogInModule(); TextView _userNameTXTVIEW = view.FindViewById <TextView>(Resource.Id.nav_userNameHome); _userNameTXTVIEW.Text = lg.GetUserName(); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.HomePage); SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar); mLocationMap = new LocationMap(); mOSMMap = new BaseOSMMap(); mHome = new Home(); mapWithLabel = new SampleWithMinimapItemizedOverlayWithFocus(); mStackFragment = new Stack <SupportFragment>(); var trans = SupportFragmentManager.BeginTransaction(); trans.Add(Resource.Id.fragmentContainer, mLocationMap, "mainPage"); trans.Add(Resource.Id.fragmentContainer, mOSMMap, "OSMMAP"); trans.Add(Resource.Id.fragmentContainer, mapWithLabel, "MapWithLabel"); trans.Add(Resource.Id.fragmentContainer, mHome, "Home"); trans.Hide(mLocationMap); trans.Hide(mOSMMap); trans.Hide(mapWithLabel); trans.Commit(); mCurrentFragment = mHome;//mMainPage; SetSupportActionBar(toolBar); SupportActionBar ab = SupportActionBar; ab.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); ab.SetDisplayHomeAsUpEnabled(true); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); if (navigationView != null) { SetUpDrawerContent(navigationView); } LogInModule lg = new LogInModule(); View header = navigationView.GetHeaderView(0); TextView _userNameTXTVIEW = header.FindViewById <TextView>(Resource.Id.nav_userName); /*View view=navigationView.inflateHeaderView(R.layout.nav_header_main);*/ _userNameTXTVIEW.Text = lg.GetUserName(); }