I am running the below code inside a new thread that I create by doing:
new Thread(new Runnable() {
public void run() {
// CODE BELOW
}
}).start();
So my runonUI code is never being executed. I am under the impression that I need to run it on the UI thread in order to update the adapter. Also am I updating the adapter correctly?
Log.d(App.app.chats.toString(),"THIS IS THE TEXTS WE SHOULD DISPLAY");
((ArrayAdapter)App.app.chatDisplay.getAdapter()).clear();
for (int i = 0; i < App.app.chats.size(); i++) {
((ArrayAdapter)App.app.chatDisplay.getAdapter()).add(App.app.chats.get(i));
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("THIS IS ACTUALLY RUNNING","TEST");
((BaseAdapter)App.app.chatDisplay.getAdapter()).notifyDataSetChanged();
}
});