android - Getting error while creating new int[]{} in listview -
i getting error while creating integer array:
madapter = new simplecursoradapter(getbasecontext(),r.layout.lv_layout,null,new string[] { "name","photo","details"},new int[]{r.id.tv_name,r.id.iv_photo,r.id.tv_details}, 0);
my code:
simplecursoradapter madapter; matrixcursor mmatrixcursor; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // contacts contacts content provider stored in cursor mmatrixcursor = new matrixcursor(new string[] { "_id","name","photo","details"} ); // adapter set data in listview madapter = new simplecursoradapter(getbasecontext(),r.layout.lv_layout,null,new string[] { "name","photo","details"},new int[]{r.id.tv_name,r.id.iv_photo,r.id.tv_details}, 0); // getting reference listview listview lstcontacts = (listview) findviewbyid(r.id.lst_contacts); // setting adapter listview lstcontacts.setadapter(madapter); // creating asynctask object retrieve , load listview contacts listviewcontactsloader listviewcontactsloader = new listviewcontactsloader(); // starting asynctask process retrieve , load listview contacts listviewcontactsloader.execute(); } }
Comments
Post a Comment