简体   繁体   English

不断收到有关localList的错误

[英]Keep getting error for localList

OK i cant seem to get this error to go away on localList. 好吧,我似乎无法在本地列表上得到此错误。 The error reads localList cannot be resolved to a variable. 读取localList的错误无法解析为变量。 I tried to put a variable but it just gave me more errors. 我试图放入一个变量,但它给了我更多的错误。 I even tried to delete the localList but it doesnt seem to resolve the problem. 我什至试图删除localList,但它似乎无法解决问题。

Heres the code 继承人代码

  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;
    }
  }
}

See your code here: 在这里查看您的代码:

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

==> your list is called paramList not localList . ==>您的列表称为paramList而不是localList There is no variable with the name localList declared in your code that is why you get localList cannot be resolved to a variable error. 在代码中没有声明名称为localList变量,这就是为什么无法将localList解析为变量错误的原因。


Update: the code where you call the super-constructor doesn't make sense to me: 更新:调用超级构造函数的代码对我来说没有意义:

super(paramInt2, paramList, localList);

==> There is no constructor for ArrayAdapter that would take an int + 2 lists (I guess you did not want localList to be an int..) as the parameters. ==>没有ArrayAdapter的构造函数将int + 2列表(我想您不希望localList成为int ..)作为参数。 That is why the error: ArrayAdapter(int, List, int) is undefined on the super(paramInt2, paramList, localList); 这就是为什么错误: 在super(paramInt2,paramList,localList)上未定义ArrayAdapter(int,List,int); shows up. 出现。 What is the idea behind this code? 该代码背后的想法是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM