java - sqlite query returns column name and string -


i have arraylist in textview prints out names of list sqlite. printing values

{salenotes=apples}  {salenotes=oranges}  

etc in textview. want textview instead.

apples oranges 

here database info

public arraylist<hashmap<string, string>> getallsalesnames1() {         arraylist<hashmap<string, string>> wordlist2;          wordlist2 = new arraylist<hashmap<string, string>>();         string selectquery2 = "select distinct salesnotes quick";         sqlitedatabase database = this.getwritabledatabase();         cursor cursor2 = database.rawquery(selectquery2, null);         if (cursor2.movetofirst()) {         {         hashmap<string, string> map2 = new hashmap<string, string>();         map2.put("salesnotes", cursor2.getstring(0));         wordlist2.add(map2);         }                     while (cursor2.movetonext());         }         database.close();         return wordlist2 ;     } 

and here in activity how database , make changes allow arraylist textview

 arraylist<hashmap<string, string>> salelist1 =  controller.getallsalesnames1();     if(salelist1.size()!=0) {     string liststring = "";     (hashmap<string, string> s : salelist1)     {liststring += s + "\n";}     system.out.println(liststring);     salenotes.settext(liststring);} 

any ideas doing wrong? works fine except unwanted {salenotes=} .i have attempted remove creating string x={salenotes=} , tried remove x salelist1 didn't work.

because "s" hashmap , printing out printing out tostring() of map.

instead try using {liststring += s.get("salesnotes") + "\n";}

(getting value based on key of salesnotes)

p.s. 1 wonders why using single entry hashmap element in arraylist? there other entries in hashmap not included in question?


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -