Hello I am facing getvibrantcolor(int) palette cannot be applied to ()
error after migrating code to Androidx before migrating it was working good. please help me to resolve this issue.
following is my code where i am initializing and using Palette with Bitmap -
Bitmap photo = setupPhoto(getIntent().getIntExtra("photo", R.drawable.xyz));
colorize(photo);
private void colorize(Bitmap photo) {
Palette palette = Palette.generate(photo);
applyPalette(palette);
}
private void applyPalette(Palette palette) {
getWindow().setBackgroundDrawable(new ColorDrawable(palette.getDarkMutedColor().getRgb()));
TextView titleView = findViewById(R.id.title);
titleView.setTextColor(palette.getVibrantColor().getRgb());
TextView descriptionView = findViewById(R.id.description);
descriptionView.setTextColor(palette.getLightVibrantColor().getRgb());
colorRipple(R.id.info, palette.getDarkMutedColor().getRgb(),
palette.getDarkVibrantColor().getRgb());
colorRipple(R.id.star, palette.getMutedColor().getRgb(),
palette.getVibrantColor().getRgb());
View infoView = findViewById(R.id.information_container);
infoView.setBackgroundColor(palette.getLightMutedColor().getRgb());
AnimatedPathView star = findViewById(R.id.star_container);
star.setFillColor(palette.getVibrantColor().getRgb());
star.setStrokeColor(palette.getLightVibrantColor().getRgb());
}
following is app build.gridle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.xxx.xxx.info"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'androidx.palette:palette:1.0.0'
}