I have a problem here, I'm getting a NullPointerException
when I try to set text inside an EditText
placed in my layout_fragment.xml.
I'm using findViewById(R.id.TextView)
on the fragment parent Activity in onCreate()
.
The activity has drawer navigation implemented and the layout_fragment.xml belongs to a the first displayed fragment of it.
Navigation.class
EditText edt_nome;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.navigation);
Intent intent = getIntent();
edt_nome = (EditText)findViewById(R.id.home_nome);
edt_nome.setText("someText");
}
The code is not much and its simplified because of a confidentiality agreement.