My application stops when I declare the TextView outside the onCreate method, I'm doing this because I need do access the TextView variable from other methods as well. I'll be grateful for any kind of help.
public class MainActivity extends ActionBarActivity {
TextView textView = (TextView)findViewById(R.id.defaultText);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
textView.setText("Hello");
}
}