java - Cannot resolve method 'setAdapter()' -


i have found several questions similar one, none of them fix issue. here code have written -

databasehelper databasehelper; arrayadapter<string> madapter; listview noteslist;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      databasehelper = new databasehelper (this);     noteslist = (listview) findviewbyid(r.id.noteslist);     loadnoteslist (); }  public void loadnoteslist () {     arraylist<string> noteslist = databasehelper.getnamelist();     if (madapter == null) {         madapter = new arrayadapter<string>(this, r.layout.row, r.id.note_name, noteslist);         noteslist.setadapter(madapter);     }      else {         madapter.clear();         madapter.addall(noteslist);         madapter.notifydatasetchanged();     } }  ... 

my code seems code in tutorial following, , code seems in correct place, know missing or did wrong, because android studio gives me error-

cannot resolve method 'setadapter(android.widget.arrayadapter<java.lang.string>)'

does see did wrong, or might need add or change? thank you!

you have introduced local variable noteslist inside loadnoteslist function:

arraylist<string> noteslist = databasehelper.getnamelist(); 

change name else.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -