http://stackoverflow.com/questions/10185624/surfaceview-in-layout I am just putting down the changes. Replace surface view in the xml with LinearLayout. <LinearLayout android:id="@+id/middleSurface" android:layout_width="wrap_content" android:layout_height="wrap_content" />Get an instance of linear layout LinearLayout surface = (LinearLayout)findViewById(R.id.surface); A..