The normal way of capturing an onClick event on a spinner (How to capture onClick event in Android for a spinner) doesn't trigger the event for a talkback user. Neither the onKeyListener or the onTouchListener is triggered. Any ideas how to achieve this?
Asked
Active
Viewed 594 times
0
-
Whats a talkback user? – Psypher Jul 11 '18 at 03:05
-
2@psypher talkback is the built in screen reader on android for visually impaired users, similar to voiceover on ios, that's why the `accessibility` tag is on this question – slugolicious Jul 11 '18 at 17:34
2 Answers
0
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});

sudesh regmi
- 536
- 4
- 12
-
1This would be for `onItemSelected`, not an `onClick` on the spinner itself – Huw Davies Jul 12 '18 at 02:31
0
spinnerFundTransferSelectTo.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
TextView selectedText = (TextView) parentView.getChildAt(0);
String text = mAccountsTo.get(position).getactType();
String talkBackText = " account number ending with " + mAccountsTo.get(position).getactType(); // mAccountsTo.get(position).getactType() is one value from array list
selectedText.setContentDescription(talkBackText);
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
}
get the view of the textview
and assign to selectedText. After that setContentDescription
for that view

Azeela
- 213
- 3
- 8
-
Code only answers aren't much use to anyone without some explanation along with it. – Vineeth Sai Jan 18 '19 at 06:48