0

I am learning how to program for Android and have seen this set of characters after objects, such is in the example I have below:

lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            //When clicked, show a toast with the TextView text
            //Toast.makeText(getApplicationContext(),((TextView) view).getText(),Toast.LENGTH_SHORT).show();

            //When clicked, shows items of the selection

        }
    });
Andy
  • 8,870
  • 1
  • 31
  • 39
allegjdm93
  • 592
  • 6
  • 24
  • 5
    Duplicate of [What is the meaning of the > token in Java?](http://stackoverflow.com/questions/6938488/what-is-the-meaning-of-the-token-in-java) and [What does > mean in Android method signature?](http://stackoverflow.com/questions/8410288/what-does-mean-in-android-method-signature) and more. I found them in the "Related" column in the right hand side of this page (which is by the way exactly the same list as you got after entering the question's title; in the future please pay attention to those possible duplicates) – BalusC Dec 08 '11 at 17:30
  • thank you and sorry for the inconvenience – allegjdm93 Dec 08 '11 at 18:20

4 Answers4

2

It is a java wildcard see here WildCard

Reid Mac
  • 2,411
  • 6
  • 37
  • 64
1

It means you are free to place any type as a parameter in this case. If it had constraints like in this case:

AdapterView<? extends A> parent;

It means you are only allowed to have subclasses of A as parameters.

Tudor
  • 61,523
  • 12
  • 102
  • 142
0

It means that the generic for AdapterView can be any class. It is not important what type it is for this method.

More information: http://docs.oracle.com/javase/tutorial/java/generics/index.html

Specifically: http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html

JustinKSU
  • 4,875
  • 2
  • 29
  • 51
0

In generics, an unknown type is represented by the wildcard character "?".

source:http://docs.oracle.com/javase/tutorial/java/generics/wildcards.html

hungneox
  • 9,333
  • 12
  • 49
  • 66