7

So I have a SeekBar in my app and I'm using the TalkBack function of Android. When the SeekBar is scrolled, the device says "(android:contentDescription of view), SeekBar control, 50%". Is it possible to change it so it says the actual value (from -4 to +4), like "SeekBar control, negative 4"?

Diego Malone
  • 1,044
  • 9
  • 25
mugiwara528
  • 381
  • 5
  • 14
  • 1
    do you want to add those -4 and +4 to both sides or when you scroll display that value eg 3.2 – Charuක Jan 09 '17 at 05:53
  • 1
    -4 to +4 is already displayed above the SeekBar control, but it is a different view so the values are not spoken as actual -4 to 4 but rather by percentage – mugiwara528 Jan 09 '17 at 05:58

3 Answers3

8

If you're using a SeekBar, I figure you're tracking the value somewhere. In our case, there is a TextView above the SeekBar that displays the current value derived from the SeekBar's progress.

I've found that setting android:accessibilityLiveRegion="assertive" as an attribute for the TextView works perfectly. It results an an announcement of the updated value (since the TextView is update), followed by the SeekBar's progress.

Note: Setting android:accessibilityLiveRegion to assertive was appropriate for us because it's less time consuming for a user to rapidly change the SeekBar's progress. Setting it to polite announces every increment, while assertive skips unannounced increments to the most recent.

Example of what I'm talking about.

Shalbert
  • 1,044
  • 11
  • 17
2

Though not the perfect answer, I found this useful method: https://developer.android.com/reference/android/view/View.html#announceForAccessibility(java.lang.CharSequence)

Which basically makes the TalkBack function talk during a specific event. I added this in the OnSeekBarChangeListener to make it "talk" every time I change the value of the slider.

mugiwara528
  • 381
  • 5
  • 14
-4

Yes, Its possible.

You said its showing "SeekBar control, 50%" means you are getting percentage.

So, use this percentage to achieve you goal:

int minValue = -4;
int maxValue = 4;
int diff = maxValue - minValue;
int realProgress = minValue + (diff * percentage / 100);

realProgress is your answer.

Hope it will help you!

Jagruttam Panchal
  • 3,152
  • 2
  • 15
  • 21