Which method returns the text of a string resource in an activity?

  1. setText(R.drawable.name)
  2. getString(R.string.name)
  3. findViewById()
  4. getDrawable(R.string.name)
Answer

B) getString(R.string.name)

getString(resId) returns the string value.

Computer Science MCQ · More Lab: Student Information App Using Resources MCQs · Practise