小编who*_*who的帖子

Android 2.3.3上的图片挂起

我有一些拍照的代码在Android 2.1和2.2中有效.但这些代码在Android 2.3上爆发.花了一些时间来解决这个徒劳的问题后,我想在这里寻求帮助.

我拍照的代码流是这样的:

创建一个类Camlayer扩展了SurfaceView

public class CamLayer extends SurfaceView implements SurfaceHolder.Callback {
    private void init(Context context){
        // Install a SurfaceHolder.Callback so we get notified when the
        // underlying surface is created and destroyed.
        mHolder = getHolder();
        mHolder.addCallback(this);
        mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        mCamera = Camera.open();
    }

    public CamLayer(Context context) {
        super(context);
        init(context);
    }

    public CamLayer(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
        Log.i(TAG+".surfaceChanged", "being called!");
        Log.i(TAG+".surfaceChanged", "w="+w); 
        Log.i(TAG+".surfaceChanged", "h="+h);
        if (isPreviewRunning) …
Run Code Online (Sandbox Code Playgroud)

camera android

10
推荐指数
3
解决办法
6448
查看次数

标签 统计

android ×1

camera ×1