views:

14

answers:

0

Hello Gurus, I am using a simple expandable list that is populated by two arrays ( group array for the groups and a multi dimensional children array for the child).

The arrays are built dynamically in the program and some group items have more children than others. So I end up defining the highest number as the array size for the multidimensional child array. After populating the child array, some positions are left null, as there are no values for those group items (explained above). When I associate this with the expandable list adapter, the getChildView method throws a nullpointer exception when it comes across a position in child array that does noto have value. I have two questions:

  1. Can I make the base adapter skip the shildview method if the value in that child is null? The current implementation of getchildView method has to return a view and even if I suppress the nullpointer exception, it adds a blank element in the child position in the list.

  2. Is there a better way of associated multidimensional arrays that are populated at run time? The current set of examples only use hardcoded string array values. Even the cursor adapters examples use very basic setup.

thank you so much for your attention and response.

Best, Pravin