java - Android Spreadsheet data into ArrayList HashMap populate ListView -


i have public google spreadsheet pulling data , loading arraylist < hashmap < string, string > >

then trying populate custom listview.

essentially spreadsheet has 3 columns "timestamp" "question1" , "question2". assuming keys hashmaps should same, value change?

i using custom arrayadapter custom xml layout 3 textviews. in getview() i've been trying iterate through hashmap , populate listview. can't seem work. when run, shows me last cell.

this code using pull individual rows spread sheet , put hashmap:

            // print entries             for(listentry row : feed.getentries())             {              //print first column's cell value                 system.out.println("new row");                for(string : row.getcustomelements().gettags())               {                      system.out.println("     "+i + ": " + row.getcustomelements().getvalue(i));                      rowmap.put(row.getcustomelements().getvalue("question1"),                              row.getcustomelements().getvalue(i));                      pulleddata2.add( (hashmap<string, string>) rowmap );                                                }              } 

list adapter , getview()

private class listadapter extends arrayadapter<hashmap<string, string>> {          private arraylist<hashmap<string, string>> mitems = pulleddata2;         public listadapter(dashboardactivity dashboardactivity, arraylist<hashmap<string, string>> items, layoutinflater inflater){              super(dashboardactivity, -1, items);             this.mitems = items;         }             @override     public view getview(int position, view convertview, viewgroup parent){          //inflate custom view         if (convertview == null){             layoutinflater inflater = (layoutinflater)                      dashboardactivity.this.getsystemservice(context.layout_inflater_service);              convertview = inflater.inflate(r.layout.listview_each_item, parent, false);         }              ((textview)convertview.findviewbyid(r.id.textviewtimestamp))                                 .settext( mitems.get(position).get("question1")); 

so problem wasn't instantiating new hashmap everytime row being pulled. added while loop , have unqiue hashmaps

                        while( <= pulleddata.size()) {                              hashmap<string, string> item = new hashmap<string, string>();                              item.put(tag, row.getcustomelements().getvalue(tag));                              //pulleddata.add(entry.getcustomelements().getvalue(tag));                             pulleddata2.add(i, item);                                i++;                         }  

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -