This is my first android application :)
I am following this example: How can I capture a video recording on Android?
My code compiles with no problem. Now, at this code line 47:
45 SurfaceView cameraView = (SurfaceView) findViewById(R.id.omVideoView);
46 Log.v(TAG, "after get camera view");
47 holder = cameraView.getHolder();
I get a NullPointerException. So probably cameraView is not found. Here's the declaration.
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical">
<SurfaceView
android:id="@+id/omVideoView"
android:layout_width="fill_parent"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
I can't understand why. I am plugging in this code into an existing app. This app has its own main Activity, and with a button I start the other Activity from the link above with the exact same code (only the view id changes).
public void showVideo(View w) {
Intent intent = new Intent(skeletonActivity.this, VideoCapture.class);
startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);
}
The main app has its layout in layout/main.xml, my new Activity (called VideoCapture) is in layout/activity_video_capture.xml