14

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!

Lara Larsen
  • 365
  • 1
  • 2
  • 16
  • I'd suggest to use Android's own Bitmap class instead of the awt image. – abbath Oct 19 '15 at 08:44
  • Hi abbath, thank you for answering. I already have the implementation and I would rather not change my code if there is a way to import JRE – Lara Larsen Oct 19 '15 at 08:46
  • I'd strongly suggest you to change your implementation – Blackbelt Oct 19 '15 at 08:47
  • But why? would importing jre library system raise other problems? – Lara Larsen Oct 19 '15 at 08:49
  • Possible duplicate of [How to add java.awt.image package in Android](http://stackoverflow.com/questions/6344654/how-to-add-java-awt-image-package-in-android) – Harald K Oct 19 '15 at 11:20
  • @LaraLarsen Android isn't a Java virtual machine (although it is similar). So to import the `java.awt.*` classes, you would need to re-implement the low-level (native) parts of AWT... Doing this might not be entirely impossible, it's just *a lot* simpler to just use Android's `Bitmap` class. – Harald K Oct 19 '15 at 11:20

1 Answers1

14

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

Community
  • 1
  • 1
ESala
  • 6,878
  • 4
  • 34
  • 55