People help please, I fight already the 2nd day.
I have observed a strange behavior when updating data in the SimpleCursorTreeAdapter. There are two Activity: ActivityButton and ActivityTreeAdapter. The first is the ActivityButton from which we can go to the ActivityTreeAdapter. The functionality of the ActivityTreeAdapter is as follows: The ability to manually create groups, and stuff elements into groups.
The problem is the following: If I write an element to the group for the first time , then when I try to expand the group, the application falls into the error " java.lang.NullPointerException " (all the data is written to).
When you re-enter the ActivityTreeAdapter, everything becomes normal, I see the group I just created, which normally unfolds. In this case, I can normally add new groups and elements without any errors.
That is, you can do this, for example, go to ActivityTreeAdapter to create groups, return to ActivityButton and back to ActivityTreeAdapter where you can create nested elements absolutely perfectly.
I suppose that the problem is in updating the cursor in the program, it is updated two times: first when creating a group, and second when adding an item to a group.
Here are the data from LogicCat:
- java.lang.au back to back to page .ExpandableListConnector.getView (ExpandableListConnector.java:450)
Here is the DEBUG:
- Thread [<1> main] (Suspended (exception NullPointerException))
ExpandableListView (ListView) .layoutChildren () line: 1662
ExpandableListView (AbsListView) .onLayout (boolean, int, int, int, int) line: 1147
ExpandableListView (View) .layout (int, int, int, int) line: 7035
LinearLayout.setChildFrame (View, int, int, int, int) line: 1249
LinearLayout.layoutVertical () line: 1125 LinearLayout.onLayout (boolean, int, int, int, int) line: 1042
LinearLayout (View) .layout (int, int, int, int) line: 7035 FrameLayout.onLayout (boolean, int, int, int, int) line: 333 FrameLayout (View) .layout (int, int, int, int) line: 7035 PhoneWindow $ DecorView (FrameLayout) .onLayout (boolean, int, int, int, int) line: 333
PhoneWindow $ DecorView (View) .layout (int, int, int, int) line: 7035
ViewRoot.performTraversals () line: 1045 ViewRoot.handleMessage (Message) line: 1727
ViewRoot (Handler) .dispatchMessage (Message) line: 99 Looper.loop () line: 123 ActivityThread.main (String []) line: 4627 Method.invokeNative (Object, Object [], Class, Class [], Class, int , boolean) line: not available [native method]
Method.invoke (Object, Object ...) line: 521
ZygoteInit $ MethodAndArgsCaller.run () line: 868
ZygoteInit.main (String []) line: 626 NativeStart.main (String []) line: not available [native method]
Here is the code for the ActivityTreeAdapter: