It shows no error but the app crash when i click the button to remove the last item in the list view. List view works fine with the arraylist... just when i want to remove the last item, it gives me a crash.
btnUndo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int count = adapter.getCount();
adapter.remove(adapter.getItem(count));
adapter.notifyDataSetChanged();
}
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…