80,351
社区成员
发帖
与我相关
我的任务
分享
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// surfaceDestroyed的时候同时对象设置为null
surfaceview = null;
surfaceHolder = null;
mediarecorder = null;
camera = null;
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
surfaceview = null;
surfaceHolder = null;
mediarecorder = null;
camera = null;
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<SurfaceView
android:id="@+id/mysurfaceview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="@+id/start"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Start" />
<Button
android:id="@+id/stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Stop" />
</LinearLayout>
</LinearLayout>
也没什么特别的啊,就一个SurfaceView 和2个按钮而已
mediarecorder.release();
camera.release();
mediarecorder = null;
camera = null;
mediarecorder.release();
试下