0

I want to make a custom getItem method in my custom adapter class. However, when I replace the default getItem with the custom one, I get an error that tells me tht I have to implement the default getItem method because I extend BaseAdapter. When I have both of them in there, it is still just returning null when I use it in my activity.

public ImageView getItem(int rowNum, int columnNum)
{
    return gridContent[rowNum][columnNum];
}

public Object getItem(int i)
{
    return null;
}
4

2 回答 2

0

你有你的类扩展了 ArrayAdapter

在这种情况下,我相信的一种特定类型是 ImageView :-?

尝试这个 :

 public T getItem(int rowNum, int columnNum)
      {
         return gridContent[rowNum][columnNum];
     }
于 2013-08-19T23:03:34.657 回答
0

它不起作用,我也有同样的问题。如果你想获取项目,你可以将你的项目保存到 HashMap 中,索引是位置。也许你可以使用 ArrayAdapter,但它只能执行简单的功能!public T getItem(int rowNum, int columnNum) { return gridContent[rowNum][columnNum]; }

于 2013-08-19T23:15:00.260 回答