简体   繁体   中英

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. 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.

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 . 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.


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. That is why the error: ArrayAdapter(int, List, int) is undefined on the super(paramInt2, paramList, localList); shows up. What is the idea behind this code?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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