Eclipse使用R.layout.camera_surface时无法解析camera_surface或不是字段时出错(Eclipse gives error as camera_surface cannot be resolved or is not a field while using R.layout.camera_surface)
我正在尝试访问Android中的相机以获取实时视频。 我正在尝试将我的内容视图设置为camera_surface 。 但是,Eclipse给出了错误,因为camera_surface cannot be resolved or is not a field
我的代码如下:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera_surface); surfaceView = (SurfaceView) findViewById(R.id.surface_camera); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); }有谁能说出什么问题?
I am trying to access the camera in Android to get the live video. I am trying to set my Content View to camera_surface. However, Eclipse gives me error as camera_surface cannot be resolved or is not a field
My code is as follows:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera_surface); surfaceView = (SurfaceView) findViewById(R.id.surface_camera); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); }Could anyone tell what is wrong?
最满意答案
问题是我需要在camera_surface.xml res->layout文件夹中创建一个名为camera_surface.xml的文件,这样才能解决问题。
The problem was that I needed to create a file called camera_surface.xml in the res->layout folder and that solved the problem.
更多推荐
发布评论