Category : android-databinding

I have been trying to experiment with data binding and so far I have encountered a problem and I don’t know how to fix it 1: Task failed with an exception. Where: Build file ‘C:UsersevereAndroidStudioProjectsSantiago1appbuild.gradle’ line: 9 What went wrong: A problem occurred evaluating project ‘:app’. Could not set unknown property ‘enabled’ for extension ‘android’ ..

Read more

When a view is made VISIBLE a certain way, Talkback can no longer select / click / focus on that view. https://github.com/kai-vala/DemoForAccessibilityBugs/blob/master/images/animation.gif (Not enough rep to link images) I tried the basics like forcing it to focusable / clickable but no luck in fixing this completely. I’m looking for a fix or workaround (maybe theres ..

Read more

I am getting crash at code line: DataBindingUtil.setContentView(this, R.layout.my_activity_layout); with error saying : java.io.FileNotFoundException: res/layout/my_activity_layout.xml at android.content.res.AssetManager.openXmlAssetNative()(AssetManager.java:-2) at android.content.res.AssetManager.openXmlBlockAsset()(AssetManager.java:485) at android.content.res.Resources.loadXmlResourceParser()(Resources.java:2799) at android.content.res.Resources.loadXmlResourceParser()(Resources.java:2772) at android.content.res.Resources.getLayout()(Resources.java:1089) at android.view.LayoutInflater.inflate()(LayoutInflater.java:412) at android.view.LayoutInflater.inflate()(LayoutInflater.java:365) at com.android.internal.policy.impl.PhoneWindow.setContentView()(PhoneWindow.java:406) at android.app.Activity.setContentView()(Activity.java:2161) at androidx.activity.ComponentActivity.setContentView()(SourceFile:365) at androidx.databinding.DataBindingUtil.setContentView()(SourceFile:303) at androidx.databinding.DataBindingUtil.setContentView()(SourceFile:284) my layout has all the code for layout binding: // my_activity_layout.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> ..

Read more

In the following android test fragment test class, https://github.com/TheReprator/UITestLearning/blob/master/app/src/androidTest/kotlin/com/example/uitest/FragmentDataBindingBTest.kt Only testDataBindingObserverValue() passed and other 2 fail(testDataBindingBDefaultValue(), testDataBindingBDefaultValue_updatedValue()), Ideally i am expecting, that i should be able to receive the initial value and then the new updated value, so i am atleast trying to make testDataBindingBDefaultValue_updatedValue(), test case to pass. My github Repo is as follows, ..

Read more

I have epoxy controller implemented using databinding in kotlin. What I need to do is update text when I click on any item and notify that as done in normal adapter. I got a project which does something like this https://github.com/xorum-io/epoxy_partial_update.git But in this project they have created EpoxyModel and used function override fun bind(view: ..

Read more

Ive defined the following custom drawable: class HexDrawable constructor(val mdl : HexDrawableModel) : Drawable() { private val paint = Paint() init { paint.color = Color.WHITE paint.textSize = 22f paint.isAntiAlias = true paint.isFakeBoldText = true paint.setShadowLayer(3f, 0f, 0f, Color.BLACK) paint.style = Paint.Style.FILL } override fun draw(canvas: Canvas) { canvas.drawText(mdl.text, 0f, 0f, paint) } override fun setAlpha(alpha: ..

Read more

I have added a new binding rule like this for ImageView which takes a custom object: @BindingAdapter({"custDrawable"}) public static void setCustDrawable(@NonNull ImageView view, HexDrawableModel model) { view.setImageDrawable(new HexDrawable(model)); } where HexDrawable extend Drawable, and data class HexDrawable(val text: String, val color: Color) so… I am not sure how to use this binding adapter in my ..

Read more

I created a RecyclerView Adapter using databinding and I’m trying to handle Click events inside this adapter but I don’t know exactly how. I found different topics but couldn’t solve my problem yet. Thanks! Where should I implement (inside the Adapter class) the onClick function? Adapter Class class RemovableContactsAdapter(val viewModel: GroupDetailsViewModel,val callback:GroupContactsCallback) : RecyclerView.Adapter<RemovableContactsViewHolder>() { ..

Read more

I cannot usage databinding for activity. (I used databinding for fragment/recyclerview). I researched all documents and all issues but it didn’t solve my problem. My problem is "unresolved reference" for variable name in xml file. Where is the problem in my project. DetailActivity.kt class DetailActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val ..

Read more