I'm trying to create a custom adapter for my Categories list. For some reason I can't access my category_item layout when I'm trying to inflate it. Here's my code:
public class CategoryAdapter extends ArrayAdapter<Category> {
LayoutInflater mInflater;
List<Category> list;
public CategoryAdapter(Context context, int resource, int textViewResourceId, List<Category> objects) {
super(context, resource, textViewResourceId, objects);
mInflater = LayoutInflater.from(context);
list = objects;
}
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if(convertView==null){
convertView=mInflater.inflate(***resource***, null);
holder = new ViewHolder();
}
return convertView;
}
// Declaring new class ViewHolder
class ViewHolder{
TextView category_name;
}
Where it says resource
I should be able to access to my category_item.xml layout - R.layout.category_item. But for some reason I don't see it in the list, I can't access it. In the matter of fact I don't see any of my layouts in the list.
Why is it happening and how can it be fixed?