android - Null pointer exception when setting values to TextView in Fragments -
i have 2 fragments in mainactivity, first one, user clicks on button , send through listener char second fragment, depends of char textview in second fragment must print text. in metho onactivitycreated textview null. this code: fragmentone public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); btnchefcito = (button)getview().findviewbyid(r.id.btnchefcito); btnchefcita = (button)getview().findviewbyid(r.id.btnchefcita); btnchefcito.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { welcomelistener.elegirsexo(sexo); replacefragment(); } }); btnchefcita.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { sexo="f"; welcomelistener.elegirsexo(sexo); replacefragment(); } }); } this second fragment @override public...