SpinnerTextView | A CustomView like Spinner for Android | Android library
kandi X-RAY | SpinnerTextView Summary
kandi X-RAY | SpinnerTextView Summary
A CustomView like Spinner for Android (Kotlin)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SpinnerTextView
SpinnerTextView Key Features
SpinnerTextView Examples and Code Snippets
Community Discussions
Trending Discussions on SpinnerTextView
QUESTION
The binding adapter has lost binding to the view model. However I have no idea what is the reason. The SpinnerTextView in the code is a textview popping an alert dialog for selecting value from a list. Setting the title will set The textview's text as the String value. The binding lost cause the textview does not show the new value, is there any solution?
I have put some breakpoints, and I found that the pickedQuantity = "0" worked and also pickedQuantity.value = quantities.value!![index] has been run too. However, in the BindingAdapter.kt only pickedQuantity = "0" triggered the setTitle function. Therefore, my TextView will always shows 0 but not changing when I select value.
BindingAdapter.kt
...ANSWER
Answered 2019-Jan-22 at 09:34You're missing a call to binding.setLifecycleOwner(this)
Sets the
LifecycleOwner
that should be used for observing changes ofLiveData
in this binding. If aLiveData
is in one of the binding expressions and noLifecycleOwner
is set, theLiveData
will not be observed and updates to it will not be propagated to the UI.
So either set the lifecycle owner or use ObservableField
instead, which is better fitting.
As adapters work differently in regards of data updates, you might want to propagate changes to the adapter data set instead and call notifyDataSetChanged()
or a similar one to update the bindings.
QUESTION
I'm adding two different spinners to my XML layout, one thats filled through an XML file and one thats filled programmatically.
...ANSWER
Answered 2018-May-30 at 10:22Try doing this. Hope this will help.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SpinnerTextView
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page