java - Populating a custom listview from List, not an ArrayList -
i trying populate custom android listview list. using sugar orm save , data database. in activity use following 2 lines data, , put in simple listview.
list<fish> fishlist = select.from(fish.class).orderby("species").list(); setlistadapter(new arrayadapter<fish>(this,android.r.layout.simple_list_item_1, fishlist));
this works expected , displays getstring() method fish class.
every method have found populating custom listview uses arraylist fishlist list. have tried 4 or 5 tutorials , come short. describe populating list manually, not how if have data in database.
i have arrayadapter classes set , @ 1 point had working load recent object list. suspected kind of loop needed couldn't working after hours of trying.
is there way populate custom listview using list, or need convert arraylist somehow, , if so, how do items in list?
can replace first line gets data database , puts in arraylist right away?
i apologize if super simple (i'm sure is) have spent 4 days trying find solution before resorting asking question here. thank can provide.
found needed here:listview populating using custom class
in my oncreate() adapter = new listadapter(this);
listview = getlistview(); list<fish> fishlist = select.from(fish.class).orderby("species").list(); //get data database (sugarorm) adapter.setdata(fishlist); listview.setadapter(adapter);
Comments
Post a Comment