I am trying to use the base64.java to convert and image into a string using
String image_str = Base64.encodeToString(bitmap, Base64.DEFAULT);
The problem is it underlines .DEFAULT saying DEFAULT cannot be resolved or is not a field. Now I see in every example I found this is what they use, so why isn't it working when I try it?
the whole function that it is in looks like
private void previewCapturedImage() {
try {
// hide video preview
imgPreview.setVisibility(View.VISIBLE);
// bimatp factory
BitmapFactory.Options options = new BitmapFactory.Options();
// downsizing image as it throws OutOfMemory Exception for larger
// images
options.inSampleSize = 8;
final Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath(),
options);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] b = baos.toByteArray();
String image_str = Base64.encodeToString(b, Base64.DEFAULT);
imgPreview.setImageBitmap(bitmap);
} catch (NullPointerException e) {
e.printStackTrace();
}
}
Thank you, Tyler