Closed bladeFury closed 10 years ago
Could you please attach whole stack trace?
sure.
FATAL EXCEPTION: main
Process: com.hb.examples.pinnedsection, PID: 18532
java.lang.IndexOutOfBoundsException: Invalid index 29, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:337)
at com.hb.examples.PinnedSectionListActivity$SimpleAdapter.getItemViewType(PinnedSectionListActivity.java:118)
at com.hb.views.PinnedSectionListView.findCurrentSectionPosition(PinnedSectionListView.java:305)
at com.hb.views.PinnedSectionListView.recreatePinnedShadow(PinnedSectionListView.java:316)
at com.hb.views.PinnedSectionListView$2.onChanged(PinnedSectionListView.java:135)
at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50)
at android.widget.ArrayAdapter.notifyDataSetChanged(ArrayAdapter.java:286)
at com.hb.examples.PinnedSectionListActivity.onListItemClick(PinnedSectionListActivity.java:238)
at android.app.ListActivity$2.onItemClick(ListActivity.java:319)
at android.widget.AdapterView.performItemClick(AdapterView.java:299)
at android.widget.AbsListView.performItemClick(AbsListView.java:1113)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2904)
at android.widget.AbsListView$3.run(AbsListView.java:3638)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
PS: I was wondering is recreating pinned shadow necessary after data set change?
This is not fixed, it is still happening!
@IncorporateApps the pull request is not accepted yet, you could try this:https://github.com/bladeFury/pinned-section-listview
how to 'called NotifyDataSetChanged()'
SimpleAdapter. NotifyDataSetChanged() ; nothing
Must be fixed now.
After called NotifyDataSetChanged(), when recreating pinned shadow:
Looks like
getFirstVisiblePosition ()
will return the visible position of the old dataset.