Skip to content

Instantly share code, notes, and snippets.

@akira-sasaki
Created November 13, 2014 19:39
Show Gist options
  • Save akira-sasaki/7221a690eb542001a3ad to your computer and use it in GitHub Desktop.
Save akira-sasaki/7221a690eb542001a3ad to your computer and use it in GitHub Desktop.
Preview.java( MyCamera )
package gclue.com.camera;
import android.content.Context;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
class Preview extends SurfaceView implements SurfaceHolder.Callback {
private static final String TAG = "MyCamera";
Preview(Context context) {
super(context);
getHolder().addCallback(this);
getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
Log.d(TAG, "onLayout l:"+l+"t:"+t+"r:"+r+"b:"+b);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "surfaceCreated");
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.d(TAG, "surfaceChanged format:"+format+"width:"+width+"height:"+height);
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "surfaceDestroyed");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment