AND-401 Exam QuestionsBrowse all questions from this exam

AND-401 Exam - Question 36


Which of the following is true about object arrayAdapter declared in the code below?

String[] items = {"Item 1","Item 2","Item 3"};

ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, items); listView.setAdapter(arrayAdapter);

Show Answer
Correct Answer: A

ArrayAdapter is used to adapt an array of data (in this case, strings) into views that can be displayed in a ListView. Specifically, ArrayAdapter uses a specified layout (here, android.R.layout.simple_list_item_1) to create a view for each item in the array. The layout android.R.layout.simple_list_item_1 contains a TextView, so the ArrayAdapter will create a TextView for each String in the array items.

Discussion

1 comment
Sign in to comment
Mmadi
Dec 31, 2022

A. It creates a TextView for each String in array items.