In my MainActivity class, I have this button:
<Button
android:id="@+id/target"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/speak"
android:layout_marginTop="20dp"
android:background="@drawable/button_red"
android:text="@string/target" />
I now want to add a badge with the number 1, using Material Design (see the documentation).
This is how I tried:
public void setBadge() {
BadgeDrawable badgeDrawable = BadgeDrawable.create(MainActivity.this);
badgeDrawable.setNumber(1);
BadgeUtils.attachBadgeDrawable(badgeDrawable, findViewById(R.id.target));
}
but what I get is the error
'attachBadgeDrawable(com.google.android.material.badge.BadgeDrawable, android.view.View, android.widget.FrameLayout)' in 'com.google.android.material.badge.BadgeUtils' cannot be applied to '(com.google.android.material.badge.BadgeDrawable, android.view.View)'