+ 1
How do I make views varibles (android)
I have tried making a text view a varible so that I can use it in functions latter (using the command work= findViewById(R.id.txt) ) but this is not working- it is saying that whatever the name of the varible is (work) can not be resolved into a varible. How do I fix this?
5 Antworten
+ 7
Cam UOR
- For EditText, Textview and any other text Fields
: Getting texts
i.g work.getText();
: Set text
i.g work.setText("yes");
+ 6
Java is strongly typed language, So you need to declare variables type first,
i.g TextView work= findviewbyid (R.id.txt);
+ 2
Thank you ah very mych
+ 1
TextView textView = (TextView) findviewbyid(R.id.text);
0
Ah thanks.
Would you also know how to access the text part
E.g.
Work.android.text ="yes"