I wonder when a SurfaceView is actually created, from a layout?
this is in a scenario where a layout is created from a Service for a LiveCard on Google Glass - thus there is no activity for which this layout can be set using setContentView().
still, I wonder what does it take for a SurfaceView to get created programmatically
I have the following layout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<SurfaceView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
and then I have:
mLayout = (FrameLayout) inflater.inflate(R.layout.orientation_recorder, null);
mLayout.setWillNotDraw(false);
cameraView = (SurfaceView) mLayout.findViewById(R.id.camera_view);
cameraView.getHolder().addCallback(new SurfaceHolder.Callback() {
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.e("OR", "camera view sufrace destroyed");
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.e("OR", "camera view sufrace created");
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.e("OR", "camera view sufrace changed "
+ " format: " + format
+ " width: " + width
+ " height: " + height);
}
});
but, I can't get the SurfaceView to get created, e.g. surfaceCreated() is never called above.
what would be needed to make this happen?