當前位置: 首頁>>代碼示例>>Java>>正文


Java PictureCallback類代碼示例

本文整理匯總了Java中android.hardware.Camera.PictureCallback的典型用法代碼示例。如果您正苦於以下問題:Java PictureCallback類的具體用法?Java PictureCallback怎麽用?Java PictureCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PictureCallback類屬於android.hardware.Camera包,在下文中一共展示了PictureCallback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void takePicture(final String fileName) {
    Log.i(TAG, "Tacking picture");
    PictureCallback callback = new PictureCallback() {

        private String mPictureFileName = fileName;

        @Override
        public void onPictureTaken(byte[] data, Camera camera) {
            Log.i(TAG, "Saving a bitmap to file");
            Bitmap picture = BitmapFactory.decodeByteArray(data, 0, data.length);
            try {
                FileOutputStream out = new FileOutputStream(mPictureFileName);
                picture.compress(Bitmap.CompressFormat.JPEG, 90, out);
                picture.recycle();
                mCamera.startPreview();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    mCamera.takePicture(null, null, callback);
}
 
開發者ID:OSCAV,項目名稱:cvRecognition,代碼行數:24,代碼來源:Tutorial3View.java

示例2: onClick

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
@Override
public void onClick(View v) {
	switch (v.getId()) {
	case R.id.take_photo_fragment_take_photo_btn:
		cameraManager.takePhoto(new PictureCallback() {
			
			@Override
			public void onPictureTaken(byte[] data, Camera camera) {
				Bitmap bitmap = BitmapUtil.toBitmap(data);
				BitmapUtil.saveBitmapToFile(bitmap, Environment.getInstance().getMyDir() + "/" + new Date().getTime() + ".jpg", CompressFormat.JPEG);
				
				Bundle bundle = new Bundle();
				bundle.putParcelable("bitmap", bitmap);
				setResult(bundle);
				
				cameraManager.restartPreview();
			}
		});
		break;

	default:
		break;
	}
}
 
開發者ID:leleliu008,項目名稱:Newton_for_Android_AS,代碼行數:25,代碼來源:TakePhotoFragment.java

示例3: requestTakePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void requestTakePicture(
        final ShutterCallback shutter,
        final PictureCallback raw,
        final PictureCallback postView,
        final PictureCallback jpeg) {
    post(new Runnable() {
        @Override
        public void run() {
            try {
                mCamera.takePicture(shutter, raw, postView, jpeg);
            } catch (RuntimeException e) {
                // TODO: output camera state and focus state for debugging.
                Log.e(TAG, "take picture failed.");
                throw e;
            }
        }
    });
}
 
開發者ID:asm-products,項目名稱:nexus-camera,代碼行數:19,代碼來源:AndroidCameraManagerImpl.java

示例4: take_picture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void take_picture(String filename, PictureCallback callback)
{
	picture_filename = filename;
	picture_callback = callback;
	mCamera.setPreviewCallback(null);
	updateOrientation();
	
	final CornerDetectionView this_ref=this;
	mCamera.autoFocus(new Camera.AutoFocusCallback()
	{
		@Override
		public void onAutoFocus(boolean success, Camera cam)
		{
			cam.takePicture(null, null, null, this_ref);
		}
	});
}
 
開發者ID:diedricm,項目名稱:MapEver,代碼行數:18,代碼來源:CornerDetectionView.java

示例5: onConfigurationChanged

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
@Override
   public void onConfigurationChanged(Configuration newConfig) {
     if (mCamera != null) {
       PictureCallback cb = new PictureCallback() {
  @Override
  public void onPictureTaken(byte[] data, Camera camera) {}
};
mCamera.takePicture(null, null, cb);
     }
   }
 
開發者ID:cuplv,項目名稱:droidel,代碼行數:11,代碼來源:Controller.java

示例6: takePhoto

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void takePhoto(PictureCallback jpeg) {
	DebugLog.d(TAG, "takePhoto()");
	
	if (camera != null) {
		camera.takePicture(null, null, jpeg);
	}
}
 
開發者ID:leleliu008,項目名稱:Newton_for_Android_AS,代碼行數:8,代碼來源:CameraManager.java

示例7: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
private void takePicture() {
    mCamera.takePicture(
            null,
            null,
            new PictureCallback() {

                @Override
                public void onPictureTaken(final byte[] jpegData, Camera camera) {
                    final Camera.Size size = camera.getParameters().getPictureSize();
                    Log.i(TAG, "Captured JPEG " + jpegData.length + " bytes (" + size.width + "x" + size.height + ")");

                    if (mImageListener != null) {
                        mCallbackHandler.post(
                                new Runnable() {
                                    @Override
                                    public void run() {
                                        mImageListener.onJpegImageAvailable(jpegData, size.width, size.height);
                                    }
                                }
                        );
                    }
                    if (mContinueTakingPictures) {
                        mCamera.startPreview();
                        takePicture();
                    }
                }
            }
    );
}
 
開發者ID:tschaumburg,項目名稱:FastBarcodeScanner,代碼行數:30,代碼來源:StillSequenceCamera.java

示例8: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public synchronized void takePicture(PictureCallback callback) {
    if (this.isFocused()) {
        try {
            this.camera.setPreviewCallback(null);
            this.camera.takePicture(this.shutterCallback, null, callback);
        } catch (RuntimeException re) {
            Log.w(TAG, "Unexpected exception while takePicture", re);
        }
    } else {
        this.pictureCallback = callback;
        this.takePicture = true;
    }
}
 
開發者ID:hschott,項目名稱:Camdroid,代碼行數:14,代碼來源:AutoFocusManager.java

示例9: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
private void takePicture() {
    PictureCallback mPicture = new PictureCallback() {
        @Override
        public void onPictureTaken(byte[] data, Camera camera) {
            new MediaSaver().execute(data);
            mCamera.startPreview();
        }
    };

    mCamera.takePicture(null, null, mPicture);

}
 
開發者ID:Bootez,項目名稱:CameraActivity,代碼行數:13,代碼來源:CameraActivity.java

示例10: setPictureListener

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void setPictureListener(PictureCallback listener) {
    pictureListener = listener;
}
 
開發者ID:jorenham,項目名稱:fingerblox,代碼行數:4,代碼來源:CameraView.java

示例11: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
@Override
public void takePicture(PictureCallback callback,
		TakePictureListener listener) {
	mCameraView.takePicture(callback,listener);
}
 
開發者ID:Alex-Jerry,項目名稱:LLApp,代碼行數:6,代碼來源:CameraContainer.java

示例12: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
@Override
public void takePicture(PictureCallback callback,CameraContainer.TakePictureListener listener){
	mCamera.takePicture(null, null, callback);
}
 
開發者ID:Alex-Jerry,項目名稱:LLApp,代碼行數:5,代碼來源:CameraView.java

示例13: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void takePicture(PictureCallback callback) {
    if (this.mAutoFocusManager != null) {
        this.mAutoFocusManager.takePicture(callback);
    }
}
 
開發者ID:hschott,項目名稱:Camdroid,代碼行數:6,代碼來源:CameraPreviewView.java

示例14: setPictureCallback

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void setPictureCallback(PictureCallback pictureCallback) {
	this.pictureCallback = pictureCallback;
}
 
開發者ID:phoenixNirvana,項目名稱:NewCommunication-Android,代碼行數:4,代碼來源:CameraManager.java

示例15: takePicture

import android.hardware.Camera.PictureCallback; //導入依賴的package包/類
public void takePicture(final PictureCallback jpegCallback) {
    if (null == camera) return;
    camera.takePicture(null, null, jpegCallback);
}
 
開發者ID:gerc99,項目名稱:SawimNE,代碼行數:5,代碼來源:Preview.java


注:本文中的android.hardware.Camera.PictureCallback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。