0

I got a string message taken from a php file. And in Android I've specified a generic string value shown below.

 private static final String message = " ";

How do i get this string value to be shown in the textview in my Android app?

ActiveUser
  • 39
  • 2
  • 5

6 Answers6

2

you can try this:

Textview mytxt=(Textview ) findViewById(R.id.textview1);
mytxt.settext(message );
Ersin Gülbahar
  • 6,713
  • 15
  • 60
  • 114
1

Putting text to textView (you need to get a hold of reference to TextView):

textView.setText(message);

More references: Android - Set text to TextView

Community
  • 1
  • 1
Unii
  • 1,497
  • 14
  • 31
0

take text view reference from findviewbyid

textView.setText(message.trim());
Bhanu Sharma
  • 5,076
  • 2
  • 22
  • 48
0

Use

 textViewName.setText(message);
jyomin
  • 1,941
  • 2
  • 10
  • 27
0

use this code

if(!(msg.equals(""))){
TextView.setText(msg);
}
Rhn Bhadani
  • 2,208
  • 1
  • 17
  • 25
0

it is very simple try the following code:

TextView yourtextview = (TextView) findViewById(R.id.yourtextview);
yourtextview.setText(message );
Farhan Shah
  • 2,306
  • 7
  • 24
  • 54