04-29-2011 10:26 AM
Hi all !
Is there a known issue in ListField that explains the raise of an OutOfboundException while removing an element of a list with only one element ?
When using listField.delete() I get this exception when the screen is trying to set the focus.
Solved! Go to Solution.
05-02-2011 02:12 AM
There may be the case that the screen does not contain any other focusable field. Hence exception is coming.
You can try
_listView.setEmptyString("List is Empty", DrawStyle.HCENTER);
which is focusable and wont give any exception after deleting last element.
05-02-2011 01:37 PM
Agree with the previous poster's suggestions. One other trick I have used in this circumstance is actually to make the ListField non focusable when it has no elements, by overriding
isFocusable() and returning false when it has no contents.
That said, this sounds like a bug to me, is it reproducible in a small piece of sample code?
05-03-2011 02:32 AM
Thank you for your answer. I finally resolved the issue in my case using the "isFocusable-overriding" solution you are describing here.
Then as the default empty string is not the best solution for me to display information when the list does not contain any element, I implement my own logic with a specific customized LabelField displayed instead of the ListField.