Cannot resolve getSystemService method in ListView adapter

后端 未结 8 1373
深忆病人
深忆病人 2021-01-25 00:23

I am working through John Horton\'s Android Programming for Beginners, and am currently attempting to create a note-taking app. Horton has just introduced ListVie

8条回答
  •  花落未央
    2021-01-25 00:28

    Create a class variable and a Constructor for your adapter:

    Context context;
    public NoteAdapter(Context context){
    this.context = context;
    }
    

    Then initialize the layoutinflater the following way:

    LayoutInflater inflater = LayoutInflater.from(context);
    

提交回复
热议问题