0
I’m creating a button called Up, to make an item in the listview go up, while the one above. But I’ve tried everything and it won’t, I don’t know if I’m wrong about logic.
But I’ve tried it in two ways. The first (Position is the ID of the item I clicked):
auxtema = tema[posicao-1];
auxpalavras = palavras[posicao-1];
auxtempo = tempo[posicao-1];
lista.remove(posicao-1);
HashMap<String,String> substituir = new HashMap<String,String>();
substituir.clear();
substituir.put("tema",auxtema+": "+auxtempo);
substituir.put("palavras",auxpalavras);
lista.add(posicao,substituir);
((BaseAdapter) resumo.getAdapter()).notifyDataSetChanged();
The second form:
auxtema = tema[posicao];
auxpalavras = palavras[posicao];
auxtempo = tempo[posicao];
auxtema1 = tema[posicao-1];
auxpalavras1 = palavras[posicao-1];
auxtempo1 = tempo[posicao-1];
lista.remove(posicao-1);
lista.remove(posicao);
HashMap<String,String> substituir = new HashMap<String,String>();
substituir.put("tema",auxtema+": "+auxtempo);
substituir.put("palavras",auxpalavras);
lista.add(posicao-1,substituir);
HashMap<String, String> substituir2 = new HashMap<String, String>();
substituir.put("tema",auxtema1+": "+auxtempo1);
substituir.put("palavras",auxpalavras1);
lista.add(posicao,substituir2);
I’m doing something wrong?
It worked fine, thank you very much. I spent hours banging head and worked with a line, programming has these right. kkkk, thanks!
– João Neto