\"Android Studio\" shows error message \"Type parameter T has incompatible upper bounds: ViewDataBinding and ActivityChecklistsBinding.
ActivityChecklistsBindin
Try This Work for sure...
Step 1: Add this code in the build.gradle(Mobile:app)
dataBinding {
enabled = true
}
Example:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
**dataBinding {
enabled = true
}**
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
.....
}
Step 2:
Binding Can be done with Name of the .xml file as below example..
Simply name of the xml file and prefix with binding...
Example 1:
if of your .xml file is activity_main.xml then Binding file should be MainActivityBinding
Example 2:
if of your .xml file is android_sunil.xml then Binding file should be AndroidSunilBinding
Step 3: Sample Code:
public class BaseObservableActivity extends AppCompatActivity {
private ActivityBaseobservableBinding activityMainBinding;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
activityMainBinding = DataBindingUtil.setContentView(this, R.layout.activity_baseobservable);
}
}
In the above code my .xml file name is activity_baseobservable so my binding class should be ActivityBaseobservableBinding activityMainBinding
--Happy Android Coding@Ambilpura