视频录制的surfaceview问题?

Cyrusfee 2016-03-30 04:33:28
首先我有2个界面,一个是主界面,另一个是录制视频的界面,我在主界面点击一个录像按钮就会跳到录制视频界面,然后录制视频界面有2个按钮,一个是开始录制,另一个是停止录制,我点了停止录制按钮后就会结束当前的录制视频界面回到主界面,然后在回到主界面的时候是没有什么问题的,但是我在主界面点击任何其他的按钮的时候就出现闪退了,打印的LOG信息如下:



我查找了一下原因,发现好像是什么没有释放,但是我在onDestroy()中已经全部释放了啊,实在是不知道什么问题,求各位帮我看一下吧。

@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;
}
...全文
172 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Birds2018 2016-04-01
  • 打赏
  • 举报
回复
问题可能出在布局设置SurfaceView里面 不知道你的代码怎么写的,现在看不出来问题的解决方法。
Cyrusfee 2016-04-01
  • 打赏
  • 举报
回复
来人看看看看看看啊!!!!!
Cyrusfee 2016-04-01
  • 打赏
  • 举报
回复
引用 6 楼 birdsaction 的回复:
问题可能出在布局设置SurfaceView里面 不知道你的代码怎么写的,现在看不出来问题的解决方法。

<?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个按钮而已
Cyrusfee 2016-03-31
  • 打赏
  • 举报
回复
有没有人可以帮我稍微看一下啊
Cyrusfee 2016-03-31
  • 打赏
  • 举报
回复
引用 3 楼 llxxhm 的回复:
mediarecorder.release();
试下
我在点结束按钮的时候已经释放掉了

                    mediarecorder.release(); 
                    camera.release();
                    mediarecorder = null;                              
                    camera = null;
QQ515311445 2016-03-31
  • 打赏
  • 举报
回复
mediarecorder.release();
试下
Cyrusfee 2016-03-30
  • 打赏
  • 举报
回复
顶上去啊,快来人啊

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧