好吧,我似乎无法在本地列表上得到此错误。读取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;
    }
  }
}

最佳答案

在这里查看您的代码:

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


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



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

super(paramInt2, paramList, localList);


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

10-06 05:09