How do I make views varibles (android) | Sololearn: Learn to code for FREE!


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( ) 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?

11/12/2020 4:48:22 AM


5 Answers

New Answer


Cam UOR - For EditText, Textview and any other text Fields : Getting texts i.g work.getText(); : Set text i.g work.setText("yes");


Java is strongly typed language, So you need to declare variables type first, i.g TextView work= findviewbyid (;


Thank you ah very mych


TextView textView = (TextView) findviewbyid(;


Ah thanks. Would you also know how to access the text part E.g. ="yes"