Reputation: 3232
For me, notifyItemInserted
in runOnUiThread
does not work.
I have runOnUiThread
in asyncTask
after download each file:
ImageModel imageModel = new ImageModel();
imageModel.setName("تصویر " );
imageModel.setUrl(aFile.getName());
imageModel.ImageFile = localFile;
data.add(imageModel);
runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.notifyItemInserted(data.size() - 1);
}
});
Upvotes: 0
Views: 413
Reputation: 1295
Not a direct answer to why it isn't working but I would recommend calling publishProgress()
and then in onProgressUpdate()
in your asynctask put your adapter call without the runOnUiThread.
Upvotes: 1