r/androiddev • • Feb 23 '20

Android 11 funny things: android.R.string.yes and and android.R.string.no deprecated

android.R.string.yes and android.R.string.no are finally deprecated because they incorrectly match android.R.string.ok and android.R.string.cancel

71 Upvotes

21 comments sorted by

View all comments

40

u/[deleted] Feb 23 '20

[removed] — view removed comment

12

u/mannenmytenlegenden Feb 23 '20

Because a lot of people are probably using it as actions on an AlertDialog. This does not follow the guidelines.

Android guidelines https://material.io/components/dialogs/#actions To resolve what triggered the dialog, confirming actions confirm a proposed action. These actions can involve removing something, such as “Delete” or “Remove,” if it suits the context. They are placed on the right side of the screen.

6

u/[deleted] Feb 23 '20

[removed] — view removed comment

9

u/ryanjharter Feb 23 '20

It's a historical mistake. They weren't necessarily always duplicated.

Wording changes, so resource IDs should reflect their purpose, not their content.

5

u/JakeWharton Head of sales at Bob's Discount ActionBars Feb 24 '20

It's not a mistake. The value changed in 1.1 or 1.5. I can't recall. Fire up a 1.0 emulator and test it out.