fahad005

binding (kotlin)

Oct 25th, 2021
736
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.firstapplication
  2.  
  3. import androidx.appcompat.app.AppCompatActivity
  4. import android.os.Bundle
  5. import android.widget.TextView
  6. import androidx.databinding.DataBindingUtil
  7. import com.example.firstapplication.databinding.ActivityMainBinding
  8.  
  9. class MainActivity : AppCompatActivity() {
  10.  
  11.     // this part
  12.     private var something : ActivityMainBinding? = null
  13.  
  14.     private var test : TextView? = null
  15.     override fun onCreate(savedInstanceState: Bundle?) {
  16.         super.onCreate(savedInstanceState)
  17.         setContentView(R.layout.activity_main)
  18.  
  19.         // this part
  20.         something = DataBindingUtil.setContentView(this, R.layout.activity_main)
  21.         something?.nameText?.text = "Fahad Pathan"
  22.         something?.email?.text = "fahadpathan56@gmail.com"
  23.     }
  24. }
RAW Paste Data