Created
July 4, 2023 06:20
-
-
Save senamit2708/c5d4a77463c178c2309872b311114c7f to your computer and use it in GitHub Desktop.
View Binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| buildFeatures { | |
| viewBinding true | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //fragment | |
| private lateinit var binding: DashboardBinding | |
| override fun onCreateView( | |
| inflater: LayoutInflater, | |
| container: ViewGroup?, | |
| savedInstanceState: Bundle? | |
| ): View? { | |
| binding = DashboardBinding.inflate(inflater, container, false) | |
| return binding.root | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //activity | |
| private lateinit var binding: ActivityMainBinding | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| binding = ActivityMainBinding.inflate(layoutInflater) | |
| setContentView(binding.root) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment