Is it possible to have a class extending SurfaceView within the activity class as an inner class? Something like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.android.iiProject.Presentation.DrawCanvas
android:id="@+id/SurfaceView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
Where the Presentation is the activity class, and the DrawCanvas is the class extending the SurfaceView, and a DrawCanvas object is called from within the Presentation activity.
I want it this way because I want to have access to methods and variables available from within the Presentation activity, and I don’t want to declare them as static to reach them from the other class, since that causes me a lot of additional problems…!
This way it’s giving me classNotFoundException at the XML file
Thanks a lot in advance
Yes, that’s possible, you just have to adress you inner class in a different way from XML, like this:
Quote:
See modifying an existing view type, point 4.