Skip to main content

Command Palette

Search for a command to run...

Personal NOTES

Notes for About Me app

Published
•1 min read•View as Markdown
Personal NOTES
H

I am a engineering student who's determined to change the time ahead .

1 -> Way to introduce a Binding variable ->

binding = DataBindingUtil.setContentView(this, R.layout.activity_main)

2 -> binding.button.setOnClickListener { addNickName(it) }

Here addNickName is the logical method while

setOnClickListener is commonly used to define the behavior that should occur when a user interacts with a clickable UI element, such as a Button, ImageView, or any other View that can receive click events.

3 ->val editText = findViewById(R.id.nickName_edit)

The findViewById method is used to obtain a reference to the EditText view with the specified ID (R.id.nickName_edit). This method is commonly used in Android when working without view binding or data binding.

4 -> But if we use data Binding then we can initialise var like this also ->

val editText = binding.nickNameEdit

More from this blog

Harsehrawat's blog

52 posts