Hi

I am trying to create a child to my SurfaceView in main.xml. My child
extends View. However the SurfaceView and my PanoramaView is inside a
ViewSwitcher and I am starting to believe that this is causing the
errors I get.

Here is my main.xml
<?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"
    >
    <ViewSwitcher android:id="@+id/switcher"
        android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
                <android.view.SurfaceView 
xmlns:android="http://schemas.android.com/
apk/res/android"
                        android:id="@+id/cam_preview"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">
                        <com.scalado.reference.panorama.PanoramaTracker
xmlns:android="http://schemas.android.com/apk/res/android";
                        android:id="@+id/tracker"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"/>
                </android.view.SurfaceView>
                <com.scalado.reference.panorama.PanoramaViewer 
xmlns:android="http://
schemas.android.com/apk/res/android"
                        android:id="@+id/viewer"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                />
        </ViewSwitcher>
</LinearLayout>

Without the PanoramaTracker view everything works fine. But now I
would like to add some overlays to my SurfaceView.

I get the following error.

W/ActivityManager(  591): Launch timeout has expired, giving up wake
lock!
W/ActivityManager(  591): Activity idle timeout for HistoryRecord
{435c52c8 {com.scalado.reference.panorama/
com.scalado.reference.panorama.PanoramaDriver}}
D/AndroidRuntime( 2074): Shutting down VM
W/dalvikvm( 2074): threadid=3: thread exiting with uncaught exception
(group=0x4000fe70)
E/AndroidRuntime( 2074): Uncaught handler: thread main exiting due to
uncaught exception
D/dalvikvm(  633): GC freed 647 objects / 35832 bytes in 322ms
E/AndroidRuntime( 2074): java.lang.RuntimeException: Unable to start
activity ComponentInfo{com.scalado.reference.panorama/
com.scalado.reference.panorama.Panora
maDriver}: java.lang.ClassCastException: android.view.SurfaceView
E/AndroidRuntime( 2074):        at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2268)
E/AndroidRuntime( 2074):        at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2284)
E/AndroidRuntime( 2074):        at android.app.ActivityThread.access
$1800(ActivityThread.java:112)
E/AndroidRuntime( 2074):        at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime( 2074):        at android.os.Handler.dispatchMessage
(Handler.java:99)
E/AndroidRuntime( 2074):        at android.os.Looper.loop(Looper.java:
123)
E/AndroidRuntime( 2074):        at android.app.ActivityThread.main
(ActivityThread.java:3948)
E/AndroidRuntime( 2074):        at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2074):        at java.lang.reflect.Method.invoke
(Method.java:521)
E/AndroidRuntime( 2074):        at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 2074):        at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 2074):        at dalvik.system.NativeStart.main
(Native Method)
E/AndroidRuntime( 2074): Caused by: java.lang.ClassCastException:
android.view.SurfaceView
E/AndroidRuntime( 2074):        at android.view.LayoutInflater.rInflate
(LayoutInflater.java:618)
E/AndroidRuntime( 2074):        at android.view.LayoutInflater.rInflate
(LayoutInflater.java:620)
E/AndroidRuntime( 2074):        at android.view.LayoutInflater.rInflate
(LayoutInflater.java:620)
E/AndroidRuntime( 2074):        at android.view.LayoutInflater.inflate
(LayoutInflater.java:407)
E/AndroidRuntime( 2074):        at android.view.LayoutInflater.inflate
(LayoutInflater.java:320)
E/AndroidRuntime( 2074):        at android.view.LayoutInflater.inflate
(LayoutInflater.java:276)
E/AndroidRuntime( 2074):        at
com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:309)
E/AndroidRuntime( 2074):        at android.app.Activity.setContentView
(Activity.java:1626)
E/AndroidRuntime( 2074):        at
com.scalado.reference.panorama.PanoramaDriver.onCreate
(PanoramaDriver.java:75)
E/AndroidRuntime( 2074):        at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1123)
E/AndroidRuntime( 2074):        at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2231)
E/AndroidRuntime( 2074):        ... 11 more

My members are:
public class PanoramaDriver extends Activity {
        private ViewSwitcher switcher=null;
        private SurfaceView cam_preview=null;
        private PanoramaViewer viewer=null;
        private PanoramaTracker tracker=null;
        private SurfaceHolder cam_previewHolder=null;
        private Camera camera=null;

My onCreate looks like:
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    this.switcher=(ViewSwitcher)findViewById(R.id.switcher);
    this.cam_preview=(SurfaceView)findViewById(R.id.cam_preview)
    this.cam_previewHolder=cam_preview.getHolder()
    this.cam_previewHolder.addCallback(camPreviewSurfaceCallback);
    this.cam_previewHolder.setType
(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    this.tracker=(PanoramaTracker)findViewById(R.id.tracker);
    this.viewer=(PanoramaViewer)findViewById(R.id.viewer);
}

Why can't I inflate this layout?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to