【问题标题】:What is add() in this tutorial using Android?本教程中使用 Android 的 add() 是什么?
【发布时间】:2014-01-08 13:16:42
【问题描述】:

我是 android 的新手,我正在关注这个 tutorial

public void setData(List<Model> data) {
        clear();
        if (data != null) {
            for (Model appEntry : data) {
                add(appEntry);
            }
        }
    }

我在 add(appEntry)line 上遇到错误:方法 add(Location) 未定义为 LocationListAdapter 类型 而 LocationListAdapter 是我从 BaseAdapter

扩展的类名

【问题讨论】:

    标签: android android-fragments asynctaskloader


    【解决方案1】:

    您应该将 LocationListAdapter 扩展到 ArrayAdapter 而不是 BaseADapter

    【讨论】:

    • 这取决于BaseAdapter是如何实现的。
    • 我添加了 extends ArrayAdapter 的代码,但它仍然在 add() 行给我错误 ERROR : The method add(Location) is undefined for type LocationListAdapter
    猜你喜欢
    • 1970-01-01
    • 2011-08-12
    • 1970-01-01
    • 2015-10-23
    • 2019-06-03
    • 1970-01-01
    • 2011-09-06
    • 2011-01-04
    • 1970-01-01
    相关资源
    最近更新 更多