Jan 16, 2010
I am new to java, eclipse, and android development, so I may be missing something simple although I have checked basic stuff like spelling several times.
View 2 Replies
Because there is no number picker control (such as that used in the date picker) in the public Android SDK, the conventional wisdom is to "clone and own" the control that exists in the Android source.
In an attempt to do that, I have copied the code for NumberPicker into my project and its dependency, NumberPickerButton. I have also copied the supporting resources.
The problem I am having is that when I try to include the NumberPicker in a layout, the rendered version of the layout within Eclipse does not work.
Adding that tag causes the Layout view of the XML file to only show the following error.
ClassCastException: com.spencerandbrown.PatientTracker1.NumberPickerButton cannot be cast to com.spencerandbrown.PatientTracker1.NumberPickerButton
I have tried both the fully qualified name and the unqualified name and it makes no difference.
The strange thing is that the control works at run time, it just will not render in Eclipse.
Is there a solution for this issue? Am I just doing something wrong?
If necessary, I can include more code from my project to clarify.
If I reference the internal Android widget, it works fine in the Eclipse layout view, but it is clumsy to interact with that way and it might break in the future.
Here is the stack trace from Eclipse.