February 22, 2012

HTC Wildfire – openRawResourceFd() fails

Nov 12th, 2010 | By fabian | Category: Blog

As I figured out in the Crash Reports, the FileDescriptor of “raw resource files”

java.io.FileDescriptor fd = getContext().getResources()
    .openRawResourceFd(R.raw.soundfile)
    .getFileDescriptor());

does not work properly. Therefore,

MediaPlayer player = new MediaPlayer();
player.setDataSource(fd);
player.prepare();

throws a java.io.IOException on every HTC Wildfire device. I assume this happens because of a bug in the HTC Wildfire with Android 2.1-update1 firmware.

One Comment to “HTC Wildfire – openRawResourceFd() fails”

  1. fabian says:

    By the way, this bug appears also on Droid X devices.

Leave a Comment