我一直在关注 ListView 的教程,下面的代码给出了错误。我搜索了所有我能找到的论坛,但我不断提出相同的推荐代码。也许所有的论坛都在引用旧版本,也许 Android 已经继续前进了。
无论如何,这是代码和错误消息:
getListView().setOnItemClickListener(new OnItemClickListener()
{
//@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
// TODO Sort out error and add function code
}
});
错误信息:
Multiple markers at this line
-The method setOnItemClickListener(AdapterView.OnItemClickListener in the type
AdapterView <ListAdapter> is not applicable for the arguments (new OnItemClickListener(){})
-OnItemClickListener cannot be resolved to a type
有什么优惠吗?