Skip to main content

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.

android-viewbinding
1 vote
1 answer
40 views

In android studio(Kotlin), why ViewBinding and setOnApplyWindowInsetsListener conflicts?

When I use codes generated by android studio automatically and ViewBinding together, the programme will crash. ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> ...
Weird_dog's user avatar
0 votes
0 answers
15 views

How can I fix the 'Unexpected tokens' error when enabling ViewBinding in build.gradle?

I'm trying to add the ViewBinding feature in the app's build.gradle file as per the official Android documentation, but I'm not getting the desired output. Instead, I'm encountering the error "...
Yash Bhalodiya's user avatar
3 votes
2 answers
51 views

How to use ViewBindings for mutiple layouts

I'm migrating from kotlinx.android.synthetic to ViewBindings. I have two layouts(for phones and tablets) with the same set of ids: class GameActivity: AppCompatActivity() { lateinit var binding: ...
undefined's user avatar
  • 685
0 votes
0 answers
24 views

Why doesn't the interaction of component from a different layout works in .kt file if not used in setContentView

I want to use authSwitch, which is a switch in custom layout file. I have inflated it and can access the switch inside IntroActivity.kt but the interaction doesn't seem to be reflected when interacted ...
kartik's user avatar
  • 163
0 votes
0 answers
13 views

Inflating Fragment View using View Binding with tow different ways

Typically, when inflating Fragments, I can use two different methods,, but I want to know the difference between them. override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, ...
Ali El-Sayed's user avatar
0 votes
1 answer
34 views

How to display result depending on the radio button choice?

I'm working on an Android Studio activity in which I have to calculate area and perimeter. I used intent to pass and access variables that will be used in another activity where the computations will ...
EJ Lin's user avatar
  • 11
0 votes
0 answers
37 views

How to pass a double value of an editText to another activity in android?

I'm working on an activity in android studio in which I need to compute area and perimeter. I used intent and view Binding to access and pass the value of the user input in the edit Text to another ...
EJ Lin's user avatar
  • 11
0 votes
1 answer
203 views

How to fix runtime error in Android studio

I am working on a project in Android Studio when I ran into an issue where it kept crashing when I attempted to run it on a real device. It worked perfectly fine at first, however as I used ...
EJ Lin's user avatar
  • 11
0 votes
0 answers
88 views

Unresolved Reference - databinding (both viewbinding and databinding enabled)

I've in the process of converting my build gradle file to kotlin dsl.. Now that I've completed it, I'm getting a databinding error Unresolved reference: databinding I am not doing any databinding, I ...
DJ-DOO's user avatar
  • 4,691
0 votes
1 answer
44 views

How to properly create a parent fragment with ViewBinding?

I have around 15 fragments that mostly use the same code, I also have created a BaseFragment for ViewBinding that works, so that I don't need to write that part every time. However there are other ...
Jesús Santoyo's user avatar
0 votes
0 answers
17 views

Cannot locate ViewBinding source code in Google repo

I'm looking to find out the source code of the view binding tool. There's probably some sort of processor or compiler plugin that consumes layout files and spits out those java source files. Where can ...
Sheroz Nazhmudinov's user avatar
0 votes
1 answer
40 views

I couldnt genarate view binding in kotlin [closed]

enter image description here When I try genarate view binding for kotlin, its giving red line on inflate and I cannot run project. package com.example.wiewbinding import androidx.appcompat.app....
Maelstrom's user avatar
0 votes
2 answers
75 views

My RecyclerView is not showing any data Android Studio(Kotlin, ViewBinding)

I am creating a weather app in which the recycler view is suppose to show today's forecast but is not showing anything. I am also not getting any kind of error in my code. I have tried everything I ...
Harsh Shrimali's user avatar
0 votes
2 answers
122 views

How to create a RadioButton custom view?

I've tried many tutorials and solutions on internet but couldn't make mine work. Basically I want a layout like this to work as 7 RadioButtons: I have my CustomRadioButton class that I want it to ...
vr4u's user avatar
  • 31
0 votes
0 answers
18 views

View Binding and Text Watcher

Is there anything I am missing while using View Binding in on Text Changed Listener. It is not working but outside the text watcher it works fine. Actually my code starts as binding.include.tv1....
qais maqbool's user avatar

15 30 50 per page
1
2 3 4 5
34