-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
` /**
* Will get the data from the map data structure, not the best solution, but it will work
* for now. Would rather have implemented a better solution where the map where better integrated
* with the ArrayAdapter, but not that much time.
*/
public void fetchNotes() {
adapter = new ArrayAdapter<>(getApplicationContext(), R.layout.support_simple_spinner_dropdown_item, getArrayList());
listview.setAdapter(adapter);
Map<String, Object> map = getMap("map", ShowNotes.this);
if(map != null) {
Iterator myVeryOwnIterator = map.keySet().iterator();
while (myVeryOwnIterator.hasNext()) {
String key = (String) myVeryOwnIterator.next();
String value = (String) map.get(key);
push(value + "\n" + key);
}
adapter.notifyDataSetChanged();
} else {
Toast.makeText(getApplicationContext(), "There is no notes to print, maybe you should make some notes first!", Toast.LENGTH_LONG).show();
}
}`
There must be a more nice way to add data from a hashmap to a listview without having to use an ArrayList, how to do this properly?