Skip to content

Instantly share code, notes, and snippets.

@thalespupo
Last active November 13, 2020 12:46
Show Gist options
  • Save thalespupo/7245ccc919e55461e799a393fd3a07d1 to your computer and use it in GitHub Desktop.
Save thalespupo/7245ccc919e55461e799a393fd3a07d1 to your computer and use it in GitHub Desktop.
MainActivity Kotlin Synthetic
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Já podemos utilizar o txtView
// sem necessidade de criar um membro p/ classe
// e fazer o findViewById
txtView?.text = "vai algum texto aqui"
txtView?.setOnClickListener { }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment