This is probably a common newbie problem, but I have not been able to
find a solution anywhere.
I have created a simple class named Panel which extends the
SurfaceView class and does some drawing in the onDraw method. When I
use it from the code it works fine. For example this works as
expected:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new Panel(this));
....
However when I try adding this component from an xml layout the
program crashes:
XML file (main.xml):
<?xml version="1.0" encoding="utf-8"?>
<org.anddev.Panel
android:id="@+id/panel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
/>
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
....
Error msg:
Sorry!
The application Test
(process org.anddev) has
stopped unexpectedly.
Pleas try again.
I can not figure out why the same class works when created in one way
and doesn't work when created in another. Help will be greatly
appreciated.
--
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