Multiple items have the same description

69 views Asked by At

I am working on Android Wear OS App development with Android Studio I got report by Google like this.

enter image description here

As you can see I got issue with the NumberPicker.

<NumberPicker
   android:id="@+id/numberPickerSecond"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="center_horizontal"
   android:layout_weight="1"
   android:descendantFocusability="blocksDescendants"
   android:formatter="@{model::formatNumber}"
   android:value="@={model.secondPickerValue}"
   app:maxValue="@{60}"
   app:minValue="@{0}" />

Here is Layout of my Timer. How to fix for Report issue?

I tried to add android:importantForAccessibility="no" on NumberPicker. But I can make sure it works or not.

2

There are 2 answers

0
Cloverleaf On

Try

app:maxValue="@{59}"

The two values 00 and 60 mean the same...

0
TofferJ On

@Cloverleaf has a good point, and you should definitely remove the "60" option from both pickers.

However, I believe the issue reported is actually caused by the lack of a content description for your pickers. You have two number pickers on the same screen and no explicit content description. This means that they will be announced in the exact same way by the screen reader, which is confusing to say the least.

The solution would be to add a content description to each of the pickers:

android:contentDescription="@string/number_picker_minutes_content_description"

and

android:contentDescription="@string/number_picker_seconds_content_description"

To test it, turn on the screen reader in Settings -> Accessibility -> TalkBack

More details about accessibility can be found here in the official documentation.