Hi I have an TextView in my android studio project. I want to access it. I know it can be done through
val myText = findViewById<TextView>(R.id.textView)
but everytime I make new function I need to declare val of myText using above code line. Like This:-
fun onDigit(view: View){
val textView = findViewById<TextView>(R.id.textView)
textView.append((view as Button).text)
}
fun onClear(view: View){
val textView = findViewById<TextView>(R.id.textView)
textView.text = ""
}
Is there any way to universally declare it and access it without declaring it in every function?
lateinit varclass level field