Multiple choice technology platforms and products

Which source snippet connect the TextView object (e.g. “tv”) with on-screen display -

  1. tv.setText(“Quiz II”)

  2. setContentView(tv)

  3. c. TextView tv = new TextView (this)

  4. setContentView()

  5. None of above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Android Activity, setContentView() connects a View or layout resource to the screen. After creating a TextView tv, calling setContentView(tv) makes it the root View displayed. setText() only changes content, and TextView tv = new TextView(this) creates the object but doesn't display it.