Skip to content

Instantly share code, notes, and snippets.

@thalespupo
Last active November 13, 2020 12:30
Show Gist options
  • Save thalespupo/9df59237aec7229a64aeb1c2bf007db7 to your computer and use it in GitHub Desktop.
Save thalespupo/9df59237aec7229a64aeb1c2bf007db7 to your computer and use it in GitHub Desktop.
MainActivity findViewById
class MainActivity : AppCompatActivity() {
private var myTextView: TextView? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
myTextView = findViewById(R.id.txtView)
// Agora podemos utilizar o txtView
myTextView?.text = "vai algum texto aqui"
myTextView?.setOnClickListener { }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment