Cannot resolve getSystemService method in ListView adapter

后端 未结 8 1377
深忆病人
深忆病人 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:41

    First make the constructor of Adapter: like follow :

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

    Now use this context:

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    

提交回复
热议问题