How to display the value of a variable on the screen?

If you have a TextView named textViewName defined in your layout XML file, you can just do something like this in your Activity class:

setContentView(R.layout.layoutName);
TextView textView = (TextView) findViewById(R.id.textViewName);
textView.setText("text you want to display");

Is this what you're looking for? If you don't need to display it to the screen, and just want to debug, just use Log() and logcat to view the messages.


If you have a list on the screen , then to not lose the list and still show change use , taking @Matt's example.

TextView textView = (TextView) findViewById(R.id.textViewName);
textView.setText("text you want to display");

It worked for me.