• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Unresolved Reference Error

Jiraiya25

Lurker
Hi, I'm new to android studio. I have installed android studio 4.2.0 and run the application on Windows 10 with i5, 8GB ram and NVIDIA MX230 Graphics. I'm simply trying to change text of a TextView named "firstText" using the .kt file as follows:
Code:
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
       firstText.text = "Welcome humans"
        }
    }
}
The firstText throws an error as "unresolved reference" and for the .text it throws "variable expected". What should I do to get this working?
 
Back
Top Bottom