# Personal NOTES

### 1 -&gt; Way to introduce a Binding variable -&gt;

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

2 -&gt; `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 -&gt;`val editText = findViewById(`[`R.id`](http://R.id)`.nickName_edit)`

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

4 -&gt; But if we use data Binding then we can initialise var like this also -&gt;

`val editText = binding.nickNameEdit`
