On Thu, Jul 2, 2009 at 3:28 AM, LD<[email protected]> wrote: > > Hello, > > I have tried to use SimpleCursorTreeAdapter class. > > So, I have created my own that extends SimpleCursorTreeAdapter, like > below: > > public MyListAdapter(MyModel model, Cursor cursor, Context context, > int groupLayout, > int childLayout, String[] groupFrom, int[] groupTo, String > [] childrenFrom, > int[] childrenTo) { > super(context, cursor, groupLayout, groupFrom, groupTo, > childLayout, childrenFrom, > childrenTo); > this.model = model; > } > > protected Cursor getChildrenCursor(Cursor groupCursor) { > long group = groupCursor.getLong(groupCursor.getColumnIndex > (Constants.ID)); > > return this.model.getChildCursor(group); > } > > As it appeared I receive Null Pointer Exception. Because in super > constructor we have call to templete method: >> protected Cursor getChildrenCursor(Cursor groupCursor) > method, that has reference to still uninitialized class field. > > How do you propose to solve this issue?
Check if this.model is null in getChildrenCursor ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

