I've a custom view button and I call setContentDescription multiple times based on the state of the custom view. I'm seeing a odd behavior from talkback, it is reading "Selected <string based on the state>, Button, <string based on old state I set before>". I printed getContentDescription and it never has once this appended format and is always only correctly displaying what is set before. If I comment out the lines of the state I don't want to be seen, I don't see the appended string. So, I'm sure the contentDescription is coming from that previous set call. Anyone knows what the heck is going on?
The code is simply this
void updateContentDescription() {
if (stateEnabled)
setContentDescription(getResources().getString(R.string.content) + " some string")
else
setContentDescription("some other string")
}
This above method is called multiple times, when the state is enabled, I see the output printed as "Selected content some string, Button, some other string"