Android :: Eclipse ClassCastException When Trying To Expand XML Layout
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.
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.
CODE:...............
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.
CODE:............
Here is the stack trace from Eclipse.
CODE:........................
View 2 Replies
Aug 8, 2010
This is probably related to this question. I want to know if anyone else gets the same error as me and if there is a way to get around this. I did the following: Followed the instructions from this page. From the top, go to File -> Create a new project -> Android Project -> Create project from existing sample. Checked Android 2.2. From the drop-down menu picked SkeletonApp. Clicked finish. From the package explorer, went to SkeletonActivity -> res -> layout -> skeleton_activity.xml. In the tabs at the bottom of the editor area (editor area is the center of the screen) clicked on Layout. Then I got the error "ClassCastException: android.widget.EditText cannot be cast to andoid.text.ViewGroup". The full text of the error message is given below.
java.lang.ClassCastException: android.widget.EditText cannot be cast to android.view.ViewGroup
at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:296)
at com.android.layoutlib.bridge.Bridge.computeLayout(Bridge.java:397)......................
View 1 Replies
View Related
Mar 9, 2012
I am using Eclipse Helios Service Release 2 and the project target is 2.2.
I have a xml layout that has a HorizontalScrollView and ScrollView with a LinearLayout. For some reason unknown to me the graphical layout will not expand when I add objects that exceed the size of the default screen size.
I have other xml layout files that will expand when using a single scrollview type, however when using two of them nested together it does not work.
I have attempted to use ScrollView then HorizontalScrollView and reversed to see if it is a order of priority issue with Eclipse. However this does not work.
There appears to be nothing missing from the properties of the scrollviews between those that will expand and the one that wont.
Is there something I am missing? Or is it not possible to have two different scrollview types in one layout and still have a auto expanding graphical layout editor? I would rather not define a specific screen resolution that would allow me to see all objects; I want the app to be adaptable to any device screen size.
View 1 Replies
View Related
Sep 3, 2009
I am using eclipse 3.5 with the ADT plugin.when I view layout xml files, i get two tabs in the view the source code view and a graphical view.the graphical view almost never works for any of my layouts.it usually shows "NullPointerException: null" at the top and nothing else. when it does work, it often does not match what i get in the simulator or device.it seems like this thing simply is not ready for prime time; although the idea is very cool.has anyone else had much success with it?
View 5 Replies
View Related
Nov 6, 2010
I want to know how to change the orientation of my layout inside of eclipse but when I click the "layout" button it still shows it as a vertical layout.
View 4 Replies
View Related
Apr 20, 2010
I have a layout I'm creating that uses ViewFlipper for different screens.In eclipse's layout editor it only displays the first page in the View.Is there a keyboard shortcut, or function to flip to the next screen?Currently I'm building each screen in a seperate XML file and then copying and pasting it into the main XML file.Is there a better way to work here?
View 2 Replies
View Related
Apr 2, 2009
I've created a new xml file in my layouts directory using eclipse's "new->xml file" wizard and i want to be able to use the built in layout editor, however, this file is not recognized as an android layout file by the editor, but rather as an ordinary file. everything compiles and runs okay, but i wanted to know how to do it better next time.
View 7 Replies
View Related
Mar 3, 2010
Looking at the search results on the internet and on this group,I find several mentions of the problem. Eclipse crashes while opening layout in the editor.
View 2 Replies
View Related
May 22, 2009
I'm using the new SDK 1.5, and I'm trying to add some elements to a layout in eclipse.When I click the green plus symbol, the dialog pops up, but it doesn't populate with anything to choose from.
View 3 Replies
View Related
Oct 29, 2009
Relative noob working with Eclipse and Android.I just switched from Windows XP to Mac (Snow Leopard) and I'm having a little trouble getting Eclipse up and running the way I like it.I installed the Android Mac SDK, but my layout editor isn't showing me a preview of the activity layout, it's just showing me the XML tree, even when I'm on the design tab.Is there something I need to do to enable the layout editor in eclipse?
View 3 Replies
View Related
Feb 27, 2009
System config is MacOSX with default JDK 1.5.0_16. Eclipse 3.4 The problem is I have a project in workspace that has been developed under JDK 1.6.I don't really want to switch back to 1.5 ( i' would have to clean up a LOT of @Override ) but if i work with this project, after couple of rebuilds - eclipse layout editor not able to display preview. Work around i found so far open android project that is in compliance with Java 1.5. Close everything else and rebuild workspace. But it's kind of annoying to do it every time.
View 2 Replies
View Related
May 28, 2009
I'm porting an app of mine to work better with API 1.5, and I'm having problems with the layout files where I'm using an AutoCompleteTextView (and, naturally, MultiAutoCompleteTextView). Whenever I have them present in a layout, the graphical representation of the layout disappears, and "NullPointerException: null" replaces it. Is there any way I can view a widget such as this in the Eclipse editor? It definitely worked in the 1.1 SDK, otherwise I wouldn't have used them.
View 2 Replies
View Related
Nov 6, 2010
I want to know how to change the orientation of my layout inside of eclipse.
View 1 Replies
View Related
Mar 30, 2010
When I create a subfolder in the layout folder, and drag an xml file to it, the generated R file doesn't seem to show the subfolder. a) is there a way to change that b) is the file and file structure still picked up by SVN and c) so, if I do it that way, can I still just refer to the object using layout?
View 2 Replies
View Related
Feb 19, 2010
The xml files that contains the Activity layouts can be rendered by Eclipse.
How do I get that Eclipse screen area to have vertical orientation, not horizontal (inside Eclipse - it correctly shows as vertical in the emulator)?
View 1 Replies
View Related
Feb 27, 2010
I'm new to Android & Eclipse. I've downloaded Eclipse and the Android ADT and created an ultra-simple "Hello World" app (has only auto-generated .java and .xml files). Eclipse CRASHES (closes after a very brief pause) when I do the following: In Package Explorer, select AppName/res/layout/main.xml Press, or double-click, or 'Open With' then 'Android Layout Editor' (The app runs OK in the Android emulator) My configuration is:
Android Development Tools 0.9.5.v200911191123-20404 com.android.ide.eclipse.adt.feature.group
Eclipse IDE for Java Developers 1.2.2.20100216-1730 epp.package.java
Windows XP
Can someone tell me what I'm doing wrong or what's wrong with my configuration? Any suggestions on what to check? For any non-trivial app development I need to be able to use the Layout Editor. More ... I can select main.xml and Right-Click and 'Open With' any of: XML Editor, XML Schema Editor, Text Editor -- with no problem. The problem is limited to Android Layout Editor.
View 3 Replies
View Related
May 11, 2010
Has anyone figured out how to scroll the contents of the Layout Editor when those contents overflow one "screen"? I'm talking about at design-time while using the ADT Layout Editor, not scrolling at run-time on a physical device (that works fine).
View 2 Replies
View Related
Dec 11, 2009
Whenever i try to open the layout.xml file in eclipse..eclipse crashes and exits without any messages.. However if i try to open the xml file without using the layout editor of ADT plugin everything is fine....it will open as an editable file..the problem started only after i updated the latest version of ADT...before that everything was working fione.
View 5 Replies
View Related
Mar 30, 2009
In the layout editor in Eclipse, I have created a custom view. For some reason, there are a few methods which cause NoSuchMethodError exceptions in the code. Here is the code in the initializer of the custom view:.............
View 2 Replies
View Related
Jul 16, 2012
i have problem in my eclipse, if i open the xml default editor means the eclipse get closed, i cant able to open the xml graphical layout, eventhough i reinstall the eclipse, same problem shout arise
View 1 Replies
View Related
Nov 4, 2009
Since Android supports styles and it's good practice to use them (similar to CSS), I made a new style and applied it to 3 buttons.
The Layout builder in Eclipse did not register the changes and either broke (showed nothing) or didn't apply styles at all.
After running the app in the emulator, styles are correctly applied.
So is there something I'm missing or the Android plugin doesn't support styles?
View 2 Replies
View Related
Nov 19, 2010
I'm currently developing an application for Android which needs to use a custom made Tabs. I have encountered two problems: I'm getting this exception when i want to switch from a text mode to wyswig mode in Eclipse. This is the actual xml code that gives me that error...
View 2 Replies
View Related
May 12, 2009
I'd also like a way to change the default, if possible.
View 1 Replies
View Related
Dec 19, 2012
Why there is difference between the screen layout in eclipse in xml editor and in the emulator?
View 1 Replies
View Related
Aug 30, 2010
I try to establisch a HttpsURLConnection with:
CODE:.................
But I get an Exception:
CODE:......................
But I can't find out, why. The same example is everywhere across the web.
View 2 Replies
View Related
May 27, 2010
I'm suffering from this for a week, i was trying to use the famous SeekBarPreference in a dialog - http://android.hlidskialf.com/blog/code/android-seekbar-preference
I copied the class from above link into my project. Then created the xml as brightness.xml:
CODE:............
Finally I try to integrate it as custom dialog:
CODE:...................
But always getting error: "Error inflating class java.lang.reflect.Constructor" at this line "<com.yoomap.anymode.SeekBarPreference" in the xml
Root cause: ClassCastException on SeekBarPreference.
View 3 Replies
View Related
May 2, 2010
I defined a local Service:
CODE:.....
The corresponding interface:
CODE:...
Then i try to bind the service in another activity in another application, where the same interface is available:
CODE:........
And
CODE:.........
But the line
CODE:......
Always throws a
CODE:...........
I can't explain why, I followed the app sample on http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceBinding.html.
View 1 Replies
View Related
May 5, 2010
Since yesterday everytime I open my layout Editor in Eclipse for the Android UI the last part goes on and on as expected if an Stackoverflow Exception occurs.Anybody else experiencing this and found a solution?I'm working with the latests android sdk on Mac OS X with Eclipse 3.5.2.I just installed the Carbon Version of eclipse and I get this error even in this fresh copy of eclipse.Very strange that I'm the only one experiencing this error. Maybe it is not an Eclipse problem but an problem of my project setup.
View 2 Replies
View Related
Mar 16, 2010
I'm sure there's a simple answer to this, but...Why can't I nest another view type within a View element? In my layout file I try:
CODE:...
And this gives me a ClassCastException. Why?
View 11 Replies
View Related
Jun 25, 2010
I'm searching for a better Android XML layout editor than the one in eclipse. Preferable placing items by drag and drop to the correct X/Y position. With the current editor I have to try out figures to place it at the exact position is there an easier way?
View 2 Replies
View Related