Free AND-401 Exam Braindumps (page: 11)

Page 10 of 58

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

String[] items = {“Item 1”,”Item 2”,”Item 3”};
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
listView.setAdapter(arrayAdapter);

  1. It creates a TextView for each String in array items.
  2. It creates Buttons for each String in array items.
  3. It creates four views for listView.
  4. It replaces the layout of the activity with three consecutive TextView items.

Answer(s): A



Which of the following is NOT a correct constructer for ArrayAdapter?

  1. ArrayAdapter(Context context)
  2. ArrayAdapter (Context context, int recourse)
  3. ArayAdpater (Context context , int resource, int textViewResourceId)
  4. ArrayAdapter (Context context , int resource, List<T> items)

Answer(s): A

Explanation:

Public ArrayAdapter Constructors include:
public ArrayAdapter (Context context, int resource)
public ArrayAdapter (Context context, int resource, int textViewResourceId)
public ArrayAdapter (Context context, int resource, List<T> objects)


Reference:

http://developer.android.com/reference/android/widget/ArrayAdapter.html



Which of the following add a click listener to items in a listView?

  1. onClickListener.
  2. onItemClickListener.
  3. onItemClicked.
  4. onListItemClickListener.

Answer(s): B

Explanation:

AdapterView.OnItemClickListener is an interface definition for a callback to be invoked when an item in this AdapterView has been clicked.


Reference:

http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html



Which of the following makes a ListView Clickable?

  1. setClickable(true)
  2. setVisibility(View.Visible)
  3. setEnabled(true)
  4. setItemsEnabled(true)

Answer(s): C






Post your Comments and Discuss Android AND-401 exam with other Community members:

AND-401 Discussions & Posts