Fixed Bug

java.lang.IllegalStateException: The content of the adapter has changed
but ListView did not receive a notification

Change-Id: I7618beebfcac228eeba704d9d7b9e985b4ceeb86
Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-02-09 09:31:03 -05:00
parent 6dbd1274b3
commit e69aa492bd

View File

@@ -70,15 +70,6 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
} }
} }
/**
* clears the rollHistory List array and refreshes the listview
* @author ricky barrette
*/
private void clearHistory() {
mDb.clearHistory(mGameId);
refresh();
}
/** /**
* also implemented OnClickListener * also implemented OnClickListener
* *
@@ -219,7 +210,7 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
quitDialog(); quitDialog();
return true; return true;
case MENU_CLEAR: case MENU_CLEAR:
clearHistory(); mDb.clearHistory(mGameId);
return true; return true;
case SETTINGS: case SETTINGS:
startActivity(new Intent(this, Settings.class).putExtras(getIntent().getExtras())); startActivity(new Intent(this, Settings.class).putExtras(getIntent().getExtras()));
@@ -346,9 +337,14 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
* @author ricky barrette * @author ricky barrette
*/ */
public void refresh(){ public void refresh(){
// mListAdapter.notifyDataSetChanged(); mListAdapter.notifyDataSetChanged();
mListView.post(new Runnable(){
@Override
public void run(){
mListView.setAdapter(mListAdapter); mListView.setAdapter(mListAdapter);
} }
});
}
/** /**
* returns a custom string containing dice rolls and number of successes * returns a custom string containing dice rolls and number of successes
@@ -482,8 +478,12 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
@Override @Override
public void onDeletionComplete() { public void onDeletionComplete() {
// do nothing this.runOnUiThread(new Runnable(){
@Override
public void run(){
refresh();
}
});
} }
@Override @Override