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

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

问题描述

我想将canvas对象保存为图像,为此我想使用ImageIO类。我正在使用Eclipse,但是当我尝试导入这个lib时(导入javax.imageio.ImageIO;)Eclipse显示错误导入javax.imageio无法解析。 PLS。告诉我我要做些什么来解决这个问题并将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 类作为起点。

Have a look at the Bitmap and BitmapFactory classes for a starting point.

这些类包含必要的读取方法( 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天全站免登陆