Which method is used to get a reference to a view defined in XML?

  1. getLayout()
  2. setContentView()
  3. getView()
  4. findViewById()
Answer

D) findViewById()

findViewById(R.id.viewId) returns the view object with that id.

Computer Science MCQ · More Lab: Android Studio Setup and First App MCQs · Practise