I am trying to create my own adapter for a list of categories. For some reason, I cannot access the category_item layout when I try to inflate it. Here is 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; }
Where he says resource I should have access to my layout category_item.xml - R.layout.category_item. But for some reason I donβt see it on the list, I canβt access it. In fact, I do not see any of my layouts in the list.
Why is this happening and how can it be fixed?
source share