无法在 Android 应用程序中导入 javax.imageio.ImageIO [英] Can't import javax.imageio.ImageIO in Android application

查看:76
本文介绍了无法在 Android 应用程序中导入 javax.imageio.ImageIO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将画布对象保存为图像,为此我想使用 ImageIO 类.我正在使用 Eclipse,但是当我尝试导入这个库 (import javax.imageio.ImageIO;) 时,Eclipse 向我显示一个错误无法解析导入 javax.imageio".请.告诉我我必须做些什么来解决这个问题并将 imageio lib 导入我的项目.

I want to save canvas object as image, and for this I want use ImageIO class. I'm using Eclipse, but when I try make import of this lib (import javax.imageio.ImageIO;) Eclipse is shows me an error "The import javax.imageio cannot be resolved". Pls. tell me what I have to do to solve this problem and import imageio lib to my project.

谢谢

推荐答案

您已使用 Android 标记了您的问题.javax.imageio.ImageIO 不是 Android 平台的一部分,所以很遗憾你不能使用它.相反,您需要使用 Android SDK 中的可用内容来读取和存储图像.

You have tagged your question with Android. javax.imageio.ImageIO is not part of the Android platform, so unfortunately you can't use it. Instead you need to use what's available in the Android SDK for reading and storing images.

看看位图BitmapFactory 类作为起点.

这些类包含读取(BitmapFactory.decode*(...) 方法)和写入(Bitmap.compress(...) 方法)的必要方法.

These classes contains the necessary methods to read (BitmapFactory.decode*(...) methods) and write (Bitmap.compress(...) method).

这篇关于无法在 Android 应用程序中导入 javax.imageio.ImageIO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆