Questions tagged [android-viewbinding]

View binding is a feature that allows you to more easily write code that interacts with views. Once view binding is enabled in a module, it generates a binding class for each XML layout file present in that module. An instance of a binding class contains direct references to all views that have an ID in the corresponding layout. In most cases, view binding replaces findViewById.

View binding is a feature that allows you to more easily write code that interacts with views. Once view binding is enabled in a module, it generates a binding class for each XML layout file present in that module.

An instance of a binding class contains direct references to all views that have an ID in the corresponding layout.

In most cases, view binding replaces findViewById.

You can see this link for more.

482 questions
0
votes
1 answer

Problems using View Binding in Android

I just got to know about ViewBinding and I am not sure if I should or shoold not use it. Bascially I have been using findViewByID and I think that it is quite convenient to use. I read about ViewBinding but honestly did not understand how to use it.…
VanessaF
  • 515
  • 11
  • 36
0
votes
2 answers

return findViewById() in viewbinding

I am trying to optimize old code. And I am trying to replace findviewbyid with viewbinding. But how do I return viewbinding id instead of findviewbyid? private TextView getTextView(int id){ return (TextView) findViewById(id); } This is the…
user12711116
0
votes
1 answer

What are the use-cases for view-binding and data-binding?

Early this year (2019), Google introduced view-binding, a new feature that allows smooth binding of UI components to data sources, just like data-binding. I went through the documentation for view-binding and I couldn't quite find any difference…
Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
-1
votes
1 answer

how to make visibility = View.GONE a certain view when launching a certain fragment when using navigation and BottomNavView

main_actiity.class activity_main XML photo main_fragment.class fragment_main XML photo enter image description here
-1
votes
1 answer

Issue with ViewBinding and custom Views

Lets assume that we have a following foo.xml and a extended…
Cativail
  • 1,040
  • 1
  • 9
  • 18
-1
votes
1 answer

I don't know how to use currnet item in viewpager

I want to use currentItem on Fragments in viewpager2 ViewPager is also fragment. and my all fragments have viewbinding. My fragment call viewpager by findViewById. But It isn't worked. It's data is always 'null'. Can I use findviewbyid and…
-1
votes
2 answers

AppCompatActivity BaseActivity Layout not displaying in View-Binding activity

I have a BaseActivity class that extends AppCompatActivity to display a common navigator toolbar, and also implements some other custom listener interfaces for a drawer layout as well. This BaseActivity class is being utilized by many other activity…
iSofia
  • 1,412
  • 2
  • 19
  • 36
-1
votes
1 answer

How can I move from one fragment to another fragment on button click? (kotlin)

I’m trying to move from one fragment to another fragment on button click and I have watched tutorials on YouTube using ViewBinding to perform this action. But each time I try, it just doesn’t seem to work. I have added the “build…
Nkay
  • 3
  • 3
-1
votes
1 answer

viewBindings vs. findViewById behavior when modifying layout objects

(i'm a software dev, but new to android development) i have a edittext field on my layout on a activity. and i would like to set a text to it. this is fairly easy. i lately i found out about viewBindings (vs. findViewById) and liked the idea. so on…
-1
votes
1 answer

Which one is view-binding?

This is the code showing for me: fun onclick(view: android.view.View) fun onclick(view: View) What's the difference between these.
-1
votes
1 answer

Android ViewBinding layout issues

I defined a layout in this way:
weirdgyn
  • 886
  • 16
  • 47
-1
votes
1 answer
-1
votes
1 answer

Not able to access toolbar in fragment viewbindig

i am facing issue with viewbinding access child of activity toolbar inside fragment. here i am accessing edittext of toolbar inside my fragment class. but not able to access via view binding. please help me solve out this issue. activityhome.xml …
-1
votes
3 answers

TextView issues after migrate from Kotlin synthetics to Jetpack view binding

I recently migrate binding method from Kotlin synthetics to Jetpack view binding. I have AutofitTextView (by grantland) in my fragment and I set some text to the textview. After I started the activity and attached the fragment, the app crash. The…
-1
votes
1 answer

Viewbinding with multible views using the same id

I am working on a project in which I want to start introducing view binding One of the layouts looks like this, the layout reuses ids for some reason I don't understand and I can't refactor it at the time being
Abdelrhman Talat
  • 1,205
  • 2
  • 13
  • 25
1 2 3
32
33