Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmoe sal
757 PointsListViewHolder cannot resolve symbol
Hello, anytime I enter "ListViewHolder" it shows in red. When I hover my cursor over the word, it says "Cannot resolve symbol". Any help?
package com.example.moe.recipeapp;
import android.media.Image; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView;
public class ListAdapter extends RecyclerView.Adapter {
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
return new ListViewHolder(view);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
((ListViewHolder) holder).bindView(position);
}
@Override
public int getItemCount() {
return 0;
}
private class listViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView textView;
private ImageView imageView;
public listViewHolder(View itemView) {
super(itemView);
textView = (TextView) itemView.findViewById(R.id.itemTextView);
imageView = (ImageView) itemView.findViewById(R.id.itemImageView);
itemView.setOnClickListener(this);
}
public void bindView(int position) {
textView.setText(Recipes.names[position]);
imageView.setImageResource(Recipes.resourceIds[position]);
}
@Override
public void onClick(View v) {
}
}
}