Have a frustrating problem with the adapter for Android ListView
I have this chunk of code:
@Override
public void onClick(View v, MotionEvent event, int position) {
int value = dice.get(position).roll();
adapter.notifyDataSetChanged();
Toast.makeText(getApplicationContext(), "Click on "+position + " | Output: "+value, Toast.LENGTH_SHORT).show();
}
Where dice
is an ArrayList of custom objects and adapter
is an extension of ArrayAdapter
. The Toast is always visible when clicking the view, but the ListView only updates sporadically. I can see no pattern to it; sometimes the view updates on click, sometimes after 2 or 3.
Any ideas? Thanks