Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import java.awt.image.BufferedImage in Android Studio

I need my android app to recognize BufferedImage and I am using Android Studio. I've seen that there is a way to import JRE library system in Eclipse but I am having trouble doing so in Android Studio.

Any ideas?

Thanks!

like image 323
Lara Larsen Avatar asked Oct 19 '15 08:10

Lara Larsen


People also ask

What is Java BufferedImage?

Java BufferedImage class is a subclass of Image class. It is used to handle and manipulate the image data. A BufferedImage is made of ColorModel of image data. All BufferedImage objects have an upper left corner coordinate of (0, 0).

What is the difference between image and BufferedImage in Java?

If you are familiar with Java's util. List, the difference between Image and BufferedImage is the same as the difference between List and LinkedList. Image is a generic concept and BufferedImage is the concrete implementation of the generic concept; kind of like BMW is a make of a Car.

What is BufferedImage Type_int_rgb?

TYPE_INT_ARGB. Represents an image with 8-bit RGBA color components packed into integer pixels. static int. TYPE_INT_ARGB_PRE. Represents an image with 8-bit RGBA color components packed into integer pixels.

How do you draw on BufferedImage?

To Draw on a BufferedImage To draw on anything, you need a Graphics or Graphics2D drawing context. You can get a graphics context from an image like this: Graphics2D gp = myImage. createGraphics(); gp.


1 Answers

You can't.

The AWT package is not supported in Android, you need to change your implementation to use the Android classes.

See these similar questions:

Porting AWT graphics code to Android

How to add java AWT image package in Android

Using AWT with Android

like image 71
ESala Avatar answered Sep 24 '22 00:09

ESala