I have to list all the elements of a String Array in a two line listView.
The String Array is dynamically and can either change in size or in content. So when the size of the String Array is 5 for example 5 listView elements shall be shown.
Have you got any idea how to do that?
I have tried it with this, but this list only the first element:
// wenn noch keine Standorte hinterlegt sind gibt es eine CursorIndexOutOfBoundsException
try {
datum_global = datenBankHelper.get_datum();
int alle_eintraege_aller_datumsangaben = datum_global.length; // Alle Einträge von allen Datumsangaben (auch von gleichen)
Log.d("size", "size " + alle_eintraege_aller_datumsangaben + "|" + datum_global[0]); // z.B. 27, da 27 Einträge für alle Datumsangaben
for(int i= 0; i < alle_eintraege_aller_datumsangaben; i++) {
gespeicherte_routen = new String[][]{
{datum_global[i], "Anzahl Einträge: " + "Test"}
};
}
} catch (CursorIndexOutOfBoundsException cs){
}
@SuppressWarnings("Convert2Diamond") ArrayList<HashMap<String, String>> list = null;
// wenn noch keine Standorte hinterlegt sind gibt es eine NullPointerException
try {
list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> item;
for (String[] routen : gespeicherte_routen) {
Log.d("schleife3", "schleife3 " + routen[0] + "|" + routen[1] + gespeicherte_routen.length);
//noinspection Convert2Diamond
item = new HashMap<String, String>();
item.put("line1", routen[0]);
item.put("line2", routen[1]);
list.add(item);
}
}catch(NullPointerException np){
}
Thanks for helping.