Issue
I have been using findViewById
and then ButterKnife to bind views. Recently, I came across this article: rel="noreferrer">https://proandroiddev.com/new-in-android-viewbindings-the-difference-from-databinding-library-bef5945baf5e and am not quite sure how to use it.
I tried doing it but it does not seem to work in Android Studio 3.4.2
val binding = MainActivityBinding.inflate(layoutInflater)
setContentView(binding.root)
then afterwards using these values, as an example :
binding.button....
binding.textView....
Solution
ViewBindings are introduced at this moment of this talk at Google IO/19. It will be available with Android Studio 3.6 and as you mentioned, you're using Android Studio 3.4.2 so it's not working. Read the ViewBindings portion in this article for more references. Hope this helps!
Answered By - SaadAAkash
Answer Checked By - Mildred Charles (JavaFixing Admin)