ArrayAdapter无法解析构造函数

时间:2016-02-12 18:03:40

标签: java android android-arrayadapter

我在oncreate方法中遇到此错误。它似乎与我之前创建的List有关。您能否提出任何有关活动的建议或我如何找到它?

model.pre('save', function (next) {
  var now = new Date();

  // Setting top-level date to deal with concurrency checks later.
  if (this.createdDate) { this.updatedDate = now; }
  else { this.createdDate = now; }

  for (var i = 0; i < (this.widgets || []); i += 1) {
    if (this.widgets[i].isNew) { this.widgets[i].createdDate = now; }
    else if (this.widgets[i].isModified()) { this.widgets[i].updatedDate = now; }
  }

  for (var i = 0; i < (this.bobbles || []); i += 1) {
    if (this.bobbles[i].isNew) { this.bobbles[i].createdDate = now; }
    else if (this.bobbles[i].isModified()) { this.bobbles[i].updatedDate = now; }
  }

  next();
});

如果我将私人列表更改为String而不是ListItem,它确实有效,有关为何或如何的任何建议?

2 个答案:

答案 0 :(得分:0)

您告诉ArrayAdapter您将使用String但是您在参数中传递了ListItem

更改

adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, items);

adapter = new ArrayAdapter<ListItem>(getActivity(), android.R.layout.simple_list_item_1, items);

private ArrayAdapter<String> adapter;

private ArrayAdapter<ListItem> adapter;

答案 1 :(得分:0)

只需在代码中添加以下行。

item = new ArrayList<ListItem>;

就在以下一行之上。

items.add(new ListItem("test", "https://google.com"));