0

so I'm using a static adapter to notify the Recycler view from outside my fragment. and when I call notifyAll() it throws: object not locked by thread before notify() in notifyAll()

I've tried the solution linked here: Object not locked by thread before notify() in onPostExecute

but using:

synchronized(adapter){
    // notify() is being called here when the thread and 
    // synchronized block does not own the lock on the object.
    adapter.notifyAll();        
}

did not fix my problem! then I've used this:

    synchronized(adapter){
        // notify() is being called here when the thread and 
        // synchronized block does not own the lock on the object.
        adapter.wait()
        adapter.notifyAll();        
    }

it causes that the app Freezed with no responding at all! any suggestions, please??

issamabuaqlien
  • 58
  • 1
  • 10
  • Are you confusing `Object.notifyAll()` with `Adapter.notifyDataSetChange()`? Are using doing multithreading at all? – Daniel Apr 03 '20 at 22:57
  • Hi Daniel! I'm not using the multithreading but I got the error above for some reason. "Adapter.notifyDataSetChange()" is not working in my situation since there is no changes in the data, the change only with a drawable. when I use an "adapter.notifyAll()" it works for the first time, then crashes as I mentioned above – issamabuaqlien Apr 04 '20 at 07:55

0 Answers0