android-viewbinding

What is the right way of Android View Binding in the RecyclerView adapter class?

為{幸葍}努か 提交于 2020-04-06 22:22:13
问题 Here is the code I used in my RecycleView adapter class. I don't know this is the right way or not to use View Binding. If you have a better solution answer me. Thank you. @Override public CategoryAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.common_circle_image, parent, false); return new MyViewHolder(itemView); } @Override public void onBindViewHolder(@NonNull CategoryAdapter

ViewBinding - Different Flavor Layout Resource

白昼怎懂夜的黑 提交于 2020-03-23 08:00:10
问题 I have a flavor which contains the same layout resource that is in my main source set. This is so it overrides the main one with the flavor specific one. I have done this in many places and it works fine until I introduced ViewBinding . For accuracy, the layout is a nested layout that is "included" in a fragment. Here is the structure: main - res - - layout - - - layout_sign_up_details_fields.xml flavor - res - - layout - - - layout_sign_up_details_fields.xml I have a view, whose ID is til

java.lang.NullPointerException: Missing required view with ID:

[亡魂溺海] 提交于 2020-03-18 12:35:12
问题 Android Studio 3.6 in app/build.gradle: android { viewBinding.enabled = true Here my xml: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/bluetoothBottonMainContainer" android:layout_width="0dp" android

java.lang.NullPointerException: Missing required view with ID:

╄→гoц情女王★ 提交于 2020-03-18 12:34:32
问题 Android Studio 3.6 in app/build.gradle: android { viewBinding.enabled = true Here my xml: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/bluetoothBottonMainContainer" android:layout_width="0dp" android

View Binding not work with “Include”: incompatible types: ProgressBarLayoutBinding cannot be converted to ViewDataBinding

泄露秘密 提交于 2020-02-28 06:17:28
问题 Android Studio 3.6. Canary 12 build.gradle: buildscript { ext.kotlin_version = '1.3.50' ext.RETROFIT_VERSION = '2.6.0' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.6.0-alpha12' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } in app/build.gradle: apply plugin: 'com.android.application' apply plugin:

Is unbinding necessary when using DataBindingUtil?

China☆狼群 提交于 2020-01-25 08:14:19
问题 I am using DataBindingUtil to bind views to variables: public class MyView extends ConstraintLayout { private ViewMyViewBinding views; public MyView(Context context) { super(context); init(context); } public MyView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(context); } public MyView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); } private void init(Context context) { views =