Android Open Source - camera Camera Texture View






From Project

Back to project page camera.

License

The source code is released under:

Apache License

If you think the Android project camera listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.yanzi.camera.preview;
/*  w w  w  . j  av  a2  s  .c  o  m*/
import org.yanzi.camera.CameraInterface;

import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.SurfaceTexture;
import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;

public class CameraTextureView extends TextureView implements TextureView.SurfaceTextureListener {
  private static final String TAG = "yanzi";
  Context mContext;
  SurfaceTexture mSurface;
  public CameraTextureView(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
    mContext = context;
    this.setSurfaceTextureListener(this);
  }
  @Override
  public void onSurfaceTextureAvailable(SurfaceTexture surface, int width,
      int height) {
    // TODO Auto-generated method stub
    Log.i(TAG, "onSurfaceTextureAvailable...");
    mSurface = surface;
//    CameraInterface.getInstance().doStartPreview(surface, 1.33f);
  }
  @Override
  public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
    // TODO Auto-generated method stub
    Log.i(TAG, "onSurfaceTextureDestroyed...");
    CameraInterface.getInstance().doStopCamera();
    return true;
  }
  @Override
  public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width,
      int height) {
    // TODO Auto-generated method stub
    Log.i(TAG, "onSurfaceTextureSizeChanged...");
  }
  @Override
  public void onSurfaceTextureUpdated(SurfaceTexture surface) {
    // TODO Auto-generated method stub
    Log.i(TAG, "onSurfaceTextureUpdated...");
    
  }
  
  /* ??Activity???TextureView??SurfaceTexture
   * @see android.view.TextureView#getSurfaceTexture()
   */
  public SurfaceTexture _getSurfaceTexture(){
    return mSurface;
  }
}




Java Source Code List

cn.bgxt.mediarecorderdemo.MainActivity.java
cn.bgxt.mediarecorderdemo.RecordActivity.java
com.example.android.photobyintent.AlbumStorageDirFactory.java
com.example.android.photobyintent.BaseAlbumDirFactory.java
com.example.android.photobyintent.FroyoAlbumDirFactory.java
com.example.android.photobyintent.PhotoIntentActivity.java
com.marcodinacci.book.acb.VideoActivity.java
org.yanzi.activity.CameraActivity.java
org.yanzi.camera.CameraInterface.java
org.yanzi.camera.preview.CameraTextureView.java
org.yanzi.util.CamParaUtil.java
org.yanzi.util.DisplayUtil.java
org.yanzi.util.FileUtil.java
org.yanzi.util.ImageUtil.java