Android 如何从相机拍摄多幅图像并保存到阵列中,然后转换64Base
这是我的职责 我必须动态捕获多个图像,并在运行时显示在图像视图中,保存到数组中,然后数组编码到Base64,然后发布到jsonAndroid 如何从相机拍摄多幅图像并保存到阵列中,然后转换64Base,android,arrays,Android,Arrays,这是我的职责 我必须动态捕获多个图像,并在运行时显示在图像视图中,保存到数组中,然后数组编码到Base64,然后发布到json private void setPic() { // Get the dimensions of the View int targetW = account_image.getWidth(); int targetH = account_image.getHeight(); // Get the dimensions of t
private void setPic() {
// Get the dimensions of the View
int targetW = account_image.getWidth();
int targetH = account_image.getHeight();
// Get the dimensions of the bitmap
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(String.valueOf(mCurrentPhotoPath), bmOptions);
int photoW = bmOptions.outWidth;
int photoH = bmOptions.outHeight;
// Determine how much to scale down the image
int scaleFactor = Math.min(photoW / targetW, photoH / targetH);
// Decode the image file into a Bitmap sized to fill the View
bmOptions.inJustDecodeBounds = false;
bmOptions.inSampleSize = scaleFactor;
bmOptions.inPurgeable = true;
Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions);
account_image.setImageBitmap(bitmap);
}
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = image.getAbsolutePath();
Log.e("Getpath", "Cool" + mCurrentPhotoPath);
return image;
}
请指导我如何完成工作您好,欢迎来到StackOverflow。请花些时间阅读帮助页面,特别是命名和的部分。更重要的是,请阅读。您可能还想了解。那么,还缺少很多代码。甚至没有定义数组。