Is not accessible in current context

后端 未结 4 1150
猫巷女王i
猫巷女王i 2021-02-05 04:58

I have the following code

public abstract class BaseAdapter extends ArrayAdapter {
    public BaseAdapter(Con         


        
4条回答
  •  野性不改
    2021-02-05 05:47

    Creation Dead Lock

    You use ModelAdapter.ModelViewHolder as the template parameter of BaseAdapter, and let ModelAdapter extends BaseAdapter, then the compiler tried to create ModelViewHolder first, but the class of ModelAdapter.ModelViewHolder(the type is Class) is not yet created. It must wait for ModelAdapter to be created, because ModelViewHolder is in the scope of ModelAdapter.

    The way to solve it is put the ModelViewHolder class into a new *.java file.

提交回复
热议问题