There are loads of default resources in android. I want to use the android.R.string.cancel
and android.R.string.ok
.
I can do this in code easily enough
getString(android.R.string.cancel)
but how do do it in the layout.xml
@string/cancel
Tried a few things
@android.R.string/cancel
@android.string/cancel
but these do not work. I'm sure I have seen this on dev tutorials, but can't find it all now.
Default resources are items that are not specific to any particular device or form factor, and therefore are the default choice by the Android OS if no more specific resources can be found. As such, they're the most common type of resource to create.
Change your resource directory By default, your resources are located in module-name /src/ source-set-name /res/ . For example, resources for your module's main source set are in src/main/res/ and resources for the debug source set are in src/debug/res/ .
It's actually @android:string/cancel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With