How can I obtain the string value “cancel” from this resource int: android.R.string.cancel ?
thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simply use
Context#getString():A DialogFragment is not a subclass of Context, so you need to get access to a valid one (like your Activity’s). Use this:
Or as your discovered you can use the Activity passed in
onAttach(), but understand you can do this anywhere inside a Fragment as long as you have a valid Context to work with.