Search code examples
javaandroidjpegsun

Use of JPEGImageDecoder on Android platform


I'm trying to use JPEGImageDecoder interface on my android application, but my application stops unexpectedly. the following code snippet:

import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageDecoder;

InputStream in = new FileInputStream(filename);
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(in);

Why my application stops unexpectedly or Can I use these packages on android?


Solution

  • Don't think you can use those packages on android. Android uses BitmapFactory (android.graphics.BitmapFactory) to handle image decoding. What does the stack trace show?