此功能打开相机,但仅拍摄一张图像和setImage,我想从相机“ Capture”拍摄3张图像,并在下面显示并将其位图发送到服务器文件夹中。此功能打开相机,但仅拍摄一个图像和setImage,我想从相机“ Capture”拍摄3个图像并在下面显示,并将其位图发送到服务器文件夹中。此功能打开相机,但仅拍摄一个图像和setImage,我想从相机“ Capture”拍摄3个图像并在下面显示,并将其位图发送到服务器文件夹中。此功能可打开相机,但仅拍摄一张图像和setImage,我想从相机“ Capture”拍摄3张图像,并在下面显示并将其位图发送到服务器文件夹中。
private void takePhotoFromCamera() {
Intent intent = new Intent(
MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
startActivityForResult(intent, CAMERA);
}
// this is function used to get intent from camera.
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == this.RESULT_CANCELED) {
return;
}
if (requestCode == CAMERA) {
Bundle extras = data.getExtras();
FixBitmap1 = (Bitmap) extras.get("data");
img.setImageBitmap(FixBitmap1);
}
// This function used to send bitmap encode url into server folder.
public void UploadImageToServer() {
FixBitmap1.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream1);
byteArray1 = byteArrayOutputStream1.toByteArray();
String ConvertImage1 = Base64.encodeToString(byteArray1, Base64.DEFAULT);
String ConvertImage2 = Base64.encodeToString(byteArray1, Base64.DEFAULT);
String ConvertImage3 = Base64.encodeToString(byteArray1, Base64.DEFAULT);
params.put("Val",ConvertImage1);
params.put("Val",ConvertImage2);
params.put("Val",ConvertImage3);