setText from inside a fragment
问题 I run a setText command inside of a fragment activity to try and set the text of a textView in the parent activity, but it's not working. Any ideas? TextView text = (TextView) getView().findViewById(R.id.status); text.setText("Text from a fragment"); I don't get an error in eclipse, but I get a null pointer exception during runtime. Of course it happens at the line where I setText. Any ideas on how to do this? 回答1: Yes your NPE will probably be because R.id.status is probably not defined in