WinDeath on notifyDataSetChanged()
Asked Answered
B

2

7

Hi I have following problem:

data.clear();
data.addAll(datasource.getFilesInFolder());  //gets the data from Sqlite database
adapter.notifyDataSetChanged();

generates this logCat output :

 12-19 14:34:30.864: W/Binder(986): Caught a RuntimeException from the binder stub implementation.
 12-19 14:34:30.864: W/Binder(986): java.lang.NullPointerException
 12-19 14:34:30.864: W/Binder(986):     at        android.inputmethodservice.IInputMethodWrapper.setSessionEnabled(IInputMethodWrapper.java:280)
 12-19 14:34:30.864: W/Binder(986):     at com.android.internal.view.IInputMethod$Stub.onTransact(IInputMethod.java:129)
 12-19 14:34:30.864: W/Binder(986):     at android.os.Binder.execTransact(Binder.java:404)
 12-19 14:34:30.864: W/Binder(986):     at dalvik.system.NativeStart.run(Native Method)
 12-19 14:34:30.864: W/InputMethodManagerService(757): Got RemoteException sending setActive(false) notification to pid 30040 uid 10174

This exception causes WIN DEATH...

Well I realized maybe it is the other way round, WIN DEATH causing this log output, because in log WINDEATH comes before this, then I have no idea why does windeath occur.

My adapter is extended BaseAdapter with nothing really special in it. Very strange is the following :

The mentioned piece of code is inside a custom listener which is triggered from another class. When I put the problematic part outside the listener it works well.

I does the Caught a RuntimeException from the binder stub implementation mean ? Can it be a problem with a database ? or maybe my custom listener ? Anyone has an idea what's wrong ?

Beehive answered 19/12, 2013 at 13:39 Comment(8)
Are you sure this stack trace is associated with this bit of code?Bilingual
Pretty sure, when i comment notifyDataSetChanged, the problem is gone...but the list is not updatedBeehive
That's bizarre. What sort of Adapter is this?Bilingual
edited the question, tried to explain more. thaks for patience.Beehive
can you post your listener code as well. Where it is causing problemBruis
Are you calling this code from some other thread?Caravaggio
Can you provide source code of Adapter?Torticollis
I switched from Listener to LocalBroadcastReceiver and it solved the problem. Still don't know what caused it not to work with listener.Beehive
P
2

I have seen various problems that have this issue when doing concurrent actions. See for instance this thread (fling + service) and this one (drawing on canvas from 2 threads).

You are talking about a custom listener in a different class, could it be that you are also doing several things at once?

Patriarchy answered 21/2, 2014 at 11:53 Comment(1)
I'm using volley to manage requests, and it queues them, so that's not the cause. the problem is related to how fast I switch between pages.Cini
E
1

You should add the data into adapter directly.

Instead of doing

data.clear();
data.addAll(datasource.getFilesInFolder());  //gets the data from Sqlite database
adapter.notifyDataSetChanged();

You should do

if(adapter!=null)
{
    adapter.clear();
    adapter.addAll(datasource.getFilesInFolder());  //gets the data from Sqlite database
    adapter.notifyDataSetChanged();
}

I think the adapter is null which is causing the problem in your case

Edlun answered 26/2, 2014 at 9:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.