Hi all
I am a new to android I wish to write automatically from code to TextViw and read in code from TextView
What is the best way to do it.
Hi all
I am a new to android I wish to write automatically from code to TextViw and read in code from TextView
What is the best way to do it.
Sorry I have ment not the TextView but the EditText
Hi all
I am a new to android I wish to write automatically from code to EditText and read in code from EditText
What is the best way to do it.
Java classes usually expose readable attributes with a get*
method, and writable attributes with a set*
method. In the case of a EditText
these are:
getText
and
setText
see here and here (they are inherited from TextView
)
Note: Scroll around a bit. You will see that they are defined multiple time. With different parameters. Pick the one you need.
A simple example. Let's assume you have a TextView with the id myTextField
:
EditText myText = (EditText) this.findViewById(R.id.myTextField);
// Setting the text:
myText.setText( "Hello World!" );
// "Reading" the text (printing it to stdout):
System.out.println( myText.getText() );