February 2015
Intermediate to advanced
780 pages
19h 22m
English
Listing 4-23. res/layout/main.xml<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <SurfaceView android:id="@+id/preview" android:layout_width="match_parent" android:layout_height="match_parent" /></RelativeLayout>
Listing 4-24. Activity Displaying Live Camera Preview
import android.hardware.Camera;public class PreviewActivity extends Activity implements SurfaceHolder.Callback { Camera mCamera; SurfaceView mPreview; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ...
Read now
Unlock full access