继续收到localList的错误

时间:2014-05-03 16:57:21

标签: java android eclipse

好吧我似乎无法将此错误消除在localList上。错误读取localList无法解析为变量。我试图放一个变量,但它只是给了我更多的错误。我甚至试图删除localList,但它似乎无法解决问题。

继承代码

  private class CustomAdapter
    extends ArrayAdapter<ListRapBeats.RowData>
  {
    public CustomAdapter(int paramInt1, int paramInt2, List<ListRapBeats.RowData> paramList)
    {
      super(paramInt2, paramList, localList);

    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      ListRapBeats.RowData localRowData = (ListRapBeats.RowData)getItem(paramInt);
      if (paramView == null)
      {
        paramView = ListRapBeats.this.mInflater.inflate(R.layout.list, null);
        paramView.setTag(new ViewHolder(paramView));
      }
      ViewHolder localViewHolder = (ViewHolder)paramView.getTag();
      localViewHolder.gettitle().setText(localRowData.mTitle);
      ImageView localImageView = localViewHolder.getImage();
      if ((ListRapBeats.this.TestSongExists(localRowData.mfileName)) || (ListRapBeats.this.downloadedSongs.contains(localRowData.mfileName)))
      {
        localImageView.setImageResource(ListRapBeats.this.imgid[0].intValue());
        return paramView;
      }
      if ((localRowData.mfileName.equals("one")) || (localRowData.mfileName.equals("two")) || (localRowData.mfileName.equals("three")))
      {
        localImageView.setImageResource(ListRapBeats.this.imgid[0].intValue());
        return paramView;
      }
    return localImageView;
    }

    private class ViewHolder
    {
      private ImageView i11 = null;
      private View mRow;
      private TextView title = null;

      public ViewHolder(View paramView)
      {
        this.mRow = paramView;
      }

      public ImageView getImage()
      {
        if (this.i11 == null) {
          this.i11 = ((ImageView)this.mRow.findViewById(R.id.itemlogo));
        }
        return this.i11;
      }

      public TextView gettitle()
      {
        if (this.title == null) {
          this.title = ((TextView)this.mRow.findViewById(R.id.title));
        }
        return this.title;
      }
    }
  }

  private class RowData
  {
    protected int mId;
    protected String mTitle;
    protected String mfileName;

    RowData(int paramInt, String paramString1, String paramString2)
    {
      this.mId = paramInt;
      this.mTitle = paramString1;
      this.mfileName = paramString2;
    }

    public String toString()
    {
      return this.mId + " " + this.mTitle + " " + this.mfileName;
    }
  }
}

1 个答案:

答案 0 :(得分:0)

在此处查看您的代码:

public CustomAdapter(int paramInt1, int paramInt2, List<ListRapBeats.RowData> paramList)

==&GT;您的列表名为paramList而不是localList。在您的代码中没有声明名称为localList的变量,这就是为什么 localList无法解析为变量错误。


更新:您调用超级构造函数的代码对我没有意义:

super(paramInt2, paramList, localList);

==&GT; ArrayAdapter没有构造函数可以将int + 2列表(我猜你不希望localList为int ..)作为参数。这就是为什么错误: ArrayAdapter(int,List,int)在super(paramInt2,paramList,localList)上未定义; 出现。这段代码背后的想法是什么?