3

I'm making my first Android app from scratch and I'm trying to stick to the MVP architecture. If I understand correctly, the Model should be independent of the platform (ie: not use any android package components).

However, in dealing with images, I'm facing issues with this because Bitmap (an Android class) seems to be the only way to implement images. I'm unable to use java.awt for some reason, and many questions I've searched have answers suggesting it is not supported in Android.

So my question is: How do I maintain my MVP architecture if I'm forced to use an android class in my Model to deal with images?

Here is a screenshot of my issue with importing java.awt.image.BufferedImage (it's in my JDK but cannot be imported): BufferedImage is in my JDK but cannot be imported

Here is one of many questions saying java.awt cannot be used: How can I import java.awt.image.BufferedImage in Android Studio

theopendle
  • 356
  • 2
  • 7

1 Answers1

0

If you want to maintain your architecture, you should not store images as Bitmap in your model. Keep them under the simpler form byte[] or something similar. Then, once in the higher levels where you can access your Android classes, transform them into a Bitmap.

Demogorii
  • 656
  • 5
  • 16