Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import javax.imageio.ImageIO in Android application

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.

Thanks

like image 328
Ivan B Avatar asked May 22 '13 13:05

Ivan B


1 Answers

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.

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

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

like image 94
Harald K Avatar answered Nov 03 '22 02:11

Harald K