This is my code :
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView editTextDay = (TextView)findViewById(R.id.editTextDay);
editTextDay.setVisibility(8); //GONE
setContentView(R.layout.main);
}
without the line ” editTextDay.setVisibility(8); ” the app doesn’t crash.
any idea on what’s wrong ?
you should set the content layout before any call of the method :
findViewById();that’s why it return null . So your code will work like this :