In getContext()
its showing "Non-static method 'getContext()' cannot be referenced from a static context" how to solve it,or what should i call instead of it.
public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.ViewHolder > {
private List<CategoryModel> CategoryModelList;
public CategoryAdapter(List<CategoryModel> categoryModelList) {
CategoryModelList = categoryModelList;
}
@NonNull
@Override
public CategoryAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
View view = LayoutInflater.from(ViewGroup.getContext()).Inflate(R.layout.category_item,viewGroup,false);
return null;
}
@Override
public void onBindViewHolder(@NonNull CategoryAdapter.ViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 0;
}
You are using ViewGroup
but it should be viewGroup