Questions tagged [viewbinding]

4 questions
2
votes
1 answer

How to dynamically use ViewBinding with nested activities on Android?

So I have this structure that I wanted to replace the working code with viewBinding instead of findViewById<> abstract class ParentActivity: AppCompatActivity() class ChildActivity: ParentActivity() activity_parent.xml is a layout that contain…
Akhu
  • 207
  • 2
  • 13
2
votes
0 answers

ViewBinding not working properly when replacing views

I am converting an old project to viewBinding. BaseActivity has a coordinator layout. App changes view of relative layout which has main_view as id. For example when user opens WorkActivity, main_view switches with activity_work. activity_base.xml …
alpertign
  • 296
  • 1
  • 4
  • 13
1
vote
1 answer

I'm unable to set the viewBinding in Android Studio

I'm stucked like 5 days in this problem! I'm unable to bind the view using viewBinding clause in Android Studio, I believe the problem is in "build.gradle" file. Initially, I tried to build the project in the way that I knew: buildFeatures {…
0
votes
1 answer

Do I have to null check every time before referencing an element in view binding?

So this isn't really a issue, I am just curious, do I really have to null check every time I use view binding? I find it a bit annoying having to put the question mark every time (binding?.[layout item]). Can somebody please give me a solution to…