0

I have this code in Android project

listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    ....

What does the AdapterView<?> mean? Like any type of AdapterView generics? What if I call some func on parent that has type in <T> either as param or return value?

michnovka
  • 2,880
  • 3
  • 26
  • 58
  • Have a look at : http://stackoverflow.com/questions/33117941/how-java-deals-with-references-to-a-generic-type/33122439#33122439 – Ravindra babu Oct 21 '15 at 05:14

1 Answers1

1

It is an example of an unbounded wildcard, AdapterView indicates a list which has an unknown object type. Methods which take such a list as a parameter will accept any type of list as argument. If you read from such list, then it will return objects of type Object.

Kaveesh Kanwal
  • 1,753
  • 17
  • 16