I am creating a button called upload, to make an item in the listview go up, while the one that was above goes down. But I've tried everything and it will not, I do not know if I'm wrong in logic.
But I tried to do 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);
Am I doing something wrong?