I have an ArrayList in a TextView that prints out all the names of my list from sqlite. It is printing the values
{saleNotes=apples}
{saleNotes=oranges}
etc in my TextView. I want my TextView to look like this instead.
apples
oranges
Here is my Database info
public ArrayList<HashMap<String, String>> getAllsalesnames1() {
ArrayList<HashMap<String, String>> wordList2;
wordList2 = new ArrayList<HashMap<String, String>>();
String selectQuery2 = "SELECT DISTINCT salesNotes FROM QUICK";
SQLiteDatabase database = this.getWritableDatabase();
Cursor cursor2 = database.rawQuery(selectQuery2, null);
if (cursor2.moveToFirst()) {
do {
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 my Activity is how I get it from the database and make the changes to allow ArrayList into TextView
ArrayList<HashMap<String, String>> saleList1 = controller.getAllsalesnames1();
if(saleList1.size()!=0) {
String listString = "";
for (HashMap<String, String> s : saleList1)
{listString += s + "\n";}
System.out.println(listString);
saleNotes.setText(listString);}
Any ideas what I am doing wrong? This works fine except for the unwanted {saleNotes=} .I have attempted to remove that by creating String x={saleNotes=} and then tried to remove x from saleList1 but that didn't work.