March 2013
Beginner to intermediate
580 pages
16h 11m
English
Create a new class named CrimeCameraFragment and make its superclass android.support.v4.app.Fragment. In CrimeCameraFragment.java, add the fields shown in Listing 19.2. Organize your imports, and when asked, import android.hardware.Camera. Then, override onCreateView(…) to inflate the layout and get references to the widgets. For now, set a listener on the button that simply finishes the hosting activity, which will return the user to the previous screen.
Listing 19.2 The initial camera fragment (CrimeCameraFragment.java)
public class CrimeCameraFragment extends Fragment {
private static final String TAG = "CrimeCameraFragment";
private Camera mCamera;
private SurfaceView mSurfaceView;
@Override
public View onCreateView(LayoutInflater ...Read now
Unlock full access