问题描述
public void onItemClick(AdapterView<?>父,View v,int position,long id)
谢谢。 这指的是一个 现在,给出所有这些: I 'm going through a code and found the following method declaration. What does Thank you. This refers to an Now, given all that: the 这篇关于什么是<?>意味着在Android方法签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!<
AdapterView
是一个泛型类。它以另一种数据类型作为参数,然后以某种方式将其操作定制为该类型。通常,您将声明一个 AdapterView
类似于
AdapterView< String> ; avs = new AdapterView< String>(...);
AdapterView
code> String s。
<?> code>表示这个方法将接受一个
AdapterView
,而不管它被定制的类。这是一个通配符类型说明符。public void onItemClick(AdapterView<?> parent, View v, int position, long id)
<?>
mean here?AdapterView
is a generic class. It takes another data type as a parameter, and its operation is then customized towards that type, in a way. Normally, you'll declare an AdapterView
something likeAdapterView<String> avs = new AdapterView<String>(...);
AdapterView
customized for String
s.<?>
means that this method will accept an AdapterView
regardless of the class it's customized for. It's a wildcard type specifier.