I really need help because I try search other forum and other problem same answer regarding to javax.imageio.ImageIO and java.awt.image.BufferedImage cannot be resolved in android studio 3.1. Suggestion say that I have to use alternative function but I couldn't find it. The function that I need is that
BufferedImage bufferedImage = ImageIO.read(file)
Full code below here;
Uri selectedImage = data.getData();
File auxFile = new File(selectedImage.toString());
try {
BufferedImage bufferedImage = ImageIO.read(auxFile);
LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result resultTxt = new MultiFormatReader().decode(bitmap);
Toast.makeText(this, "result:"+resultTxt.getText(), Toast.LENGTH_LONG).show();
}catch (IOException e){
}catch (NotFoundException e) {
e.printStackTrace();
}
I really appreciated those who can help me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…