Created
November 13, 2014 19:12
-
-
Save akira-sasaki/c6f98614a34818d230ff to your computer and use it in GitHub Desktop.
Preview.java( MyCamera )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gclue.com.camera; | |
import android.content.Context; | |
import android.util.Log; | |
import android.view.SurfaceHolder; | |
import android.view.SurfaceView; | |
import android.view.ViewGroup; | |
class Preview extends ViewGroup implements SurfaceHolder.Callback { | |
private static final String TAG = "MyCamera"; | |
private static SurfaceView mSurfaceView; | |
private static SurfaceHolder mHolder; | |
Preview(Context context) { | |
super(context); | |
// SurfaceViewを画面に設定. | |
mSurfaceView = new SurfaceView(context); | |
addView(mSurfaceView); | |
mHolder = mSurfaceView.getHolder(); | |
mHolder.addCallback(this); | |
mHolder.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