I’m trying to prepare a view to be shown by update the text in the textview before I ever switch over to that view.
I’ve declared the textview variable as public, initialized it in the OnCreate
Info = (TextView) findViewById(R.id.BackDialogText);
And then when it comes time to change the text, I get a nullpointerException
Info.setText(TheString);
setContentView(R.layout.mydialog_layout);
I’ve run the app without the setText and it runs fine, showing me my view with the predefined text. Is there some trick I’m missing to update the text of the view?
Basically before you set the view
to your activity you cannot use the elements inside the view in your code. So you must have something like this in your code