Hi,
I have a problem with ExpandableListView crash. When an
ExpaldableListView first starts with empty cursor (cursor without data
row) and later on change a cursor with data row. There is 100% chance
the ExpandableListView will crash when expand mainGroup item. I am not
sure is it a bug in Android because I can't find any bug in my code.
Below is the step i used to reproduce the crash

(1) In onCreate, create simpleCursorTreeAdapter and make sure the data
set returned is empty.
(2) In onCreate, add the simpleCursorTreeAdapter to an
ExpandableListView
(3) when button "add" is clickked, i will do myAdapter.getCursor
().reQuery();   myAdapter.notifyDataSetChanged()
(4) At this point, there will be a newly added and the only row in
ExpandableListAdapter.
(5) Click on the item to make the list expand. Then my program will
crash.

Note: It doesn't matter if there is child row under the group i
clicked. it will just crash.


####################Logcat report####################
  5971         AndroidRuntime  E
java.lang.NullPointerException
  5971         AndroidRuntime  E        at
android.widget.SimpleCursorTreeAdapter.bindView
(SimpleCursorTreeAdapter.java:200)
  5971         AndroidRuntime  E        at
android.widget.SimpleCursorTreeAdapter.bindChildView
(SimpleCursorTreeAdapter.java:218)
  5971         AndroidRuntime  E        at
android.widget.CursorTreeAdapter.getChildView(CursorTreeAdapter.java:
250)
  5971         AndroidRuntime  E        at
com.smart.expense.expense2$myMainExpandableListAdapter.getChildView
(expense2.java:578)
  5971         AndroidRuntime  E        at
android.widget.ExpandableListConnector.getView
(ExpandableListConnector.java:451)
  5971         AndroidRuntime  E        at
android.widget.AbsListView.obtainView(AbsListView.java:
1272)
  5971         AndroidRuntime  E        at
android.widget.ListView.measureHeightOfChildren(ListView.java:
1142)
  5971         AndroidRuntime  E        at
android.widget.ListView.onMeasure(ListView.java:1055)
  5971         AndroidRuntime  E        at android.view.View.measure
(View.java:7117)
  5971         AndroidRuntime  E        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  5971         AndroidRuntime  E        at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:
888)
  5971         AndroidRuntime  E        at
android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
  5971         AndroidRuntime  E        at
android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
  5971         AndroidRuntime  E        at android.view.View.measure
(View.java:7117)
  5971         AndroidRuntime  E        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  5971         AndroidRuntime  E        at
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  5971         AndroidRuntime  E        at android.view.View.measure
(View.java:7117)
  5971         AndroidRuntime  E        at
android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
  5971         AndroidRuntime  E        at
android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
  5971         AndroidRuntime  E        at android.view.View.measure
(View.java:7117)
  5971         AndroidRuntime  E        at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2929)
  5971         AndroidRuntime  E        at
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
  5971         AndroidRuntime  E        at android.view.View.measure
(View.java:7117)
  5971         AndroidRuntime  E        at
android.view.ViewRoot.performTraversals(ViewRoot.java:713)
  5971         AndroidRuntime  E        at
android.view.ViewRoot.handleMessage(ViewRoot.java:1504)
  5971         AndroidRuntime  E        at
android.os.Handler.dispatchMessage(Handler.java:99)
  5971         AndroidRuntime  E        at android.os.Looper.loop
(Looper.java:123)
  5971         AndroidRuntime  E        at
android.app.ActivityThread.main(ActivityThread.java:3948)
  5971         AndroidRuntime  E        at
java.lang.reflect.Method.invokeNative(Native Method)
  5971         AndroidRuntime  E        at
java.lang.reflect.Method.invoke(Method.java:521)
  5971         AndroidRuntime  E        at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
  5971         AndroidRuntime  E        at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  5971         AndroidRuntime  E        at
dalvik.system.NativeStart.main(Native Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to