java - resource not found when populating list in android -


i trying simple list in android application , fill strings. have implemented following main activity:

public class mainmenuactivity extends baseactivity{  private arraylist<string> teamlist = new arraylist<string>(); private arrayadapter<string> teamlistadapter; private listview teamlistview;  protected void loadgui() {     setcontentview(r.layout.main_login);     teamlistview = (listview) findviewbyid(r.id.teamlist);     teamlistadapter = new arrayadapter<string>(mcontext, r.id.teamlist, teamlist);     teamlistview.setadapter(teamlistadapter);     additem("test"); }  public void additem(string item) {     teamlist.add(item);     teamlistadapter.notifydatasetchanged(); } 

}

with baseactivity class implementing oncreate methods etc:

public abstract class baseactivity extends activity {  protected activity mactivity; protected context mcontext;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     mactivity = this;     mcontext = getapplicationcontext(); }  @override public boolean oncreateoptionsmenu(menu menu) {     getmenuinflater().inflate(r.menu.menu, menu);     return true; }  @override public void onresume() {     super.onresume();     loadgui(); }  protected abstract void loadgui(); } 

when try run this, error:

05-09 16:50:04.386: e/androidruntime(12037): android.content.res.resources$notfoundexception: resource id #0x7f070002 type #0x12 not valid 

this error caused function call off additem, not know problem function. see wrong?

you're passing in wrong type of resource constructor of arrayadaper. parameter 2 should the resource id layout file containing textview use when instantiating views.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -