如何在android中加载BufferedImage?
我想在我的应用程序中加载 BufferedImage 。为此,我正在使用 ImageIO
但我收到 java.lang.NoClassDefFoundError
:
BufferedImage tgtImg = loadImage("ImageD2.jpg");
public static BufferedImage loadImage(String ref) {
BufferedImage bimg = null;
try {
bimg = ImageIO.read(new File(ref));
} catch (Exception e) {
e.printStackTrace();
}
return bimg;
}
但我收到异常:
03-15 18:05:22.051: ERROR/AndroidRuntime(437): java.lang.NoClassDefFoundError: javax.imageio.ImageIO
I want to load BufferedImage
in my application. For that I am using ImageIO
but I am getting java.lang.NoClassDefFoundError
:
BufferedImage tgtImg = loadImage("ImageD2.jpg");
public static BufferedImage loadImage(String ref) {
BufferedImage bimg = null;
try {
bimg = ImageIO.read(new File(ref));
} catch (Exception e) {
e.printStackTrace();
}
return bimg;
}
but i am getting exception:
03-15 18:05:22.051: ERROR/AndroidRuntime(437): java.lang.NoClassDefFoundError: javax.imageio.ImageIO
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android SDK 不支持 ImageIO
您能否使用
Bitmap< 实现相同的效果/code>
和
BitmapFactory
??像这样...如果此后
tgtImg
不为null
那么它就成功了。ImageIO is not supported in Android SDK
Could you achieve the same thing with
Bitmap
andBitmapFactory
?? like so...if
tgtImg
is notnull
after this then it was successful.