전화 memmory에서 이미지를로드하려고하면 오류가 발생합니다. errorjava/lang/OutOfMemoryError 또는 nativedecodeImage. 전화 메모리의 일부 이미지는 12kd이고 다른 이미지는 589kb 또는 600kb입니다. 작은 크기의 이미지는 목록으로 가져 오지만 큰 이미지의 경우에는 OOM 오류가 발생합니다 .. ?? 내가OutOfMemoryError를 해결하는 방법
image = Image.createImage(imageData, 0, length);
사람이 이것에 대해 어떤 생각을 가지고 있는가에 오류가 얻을 곳
이
내 코드FileConnection finalConnection;
try
{
fc.close();
finalConnection = (FileConnection) Connector.open(path, Connector.READ_WRITE);
if(finalConnection.exists())
{
InputStream fis = finalConnection.openInputStream();
long overallSize = finalConnection.fileSize();
int length = 0;
byte[] imageData = new byte[0];
while (length < overallSize)
{
byte[] data = new byte[CHUNK_SIZE];
int readAmount = fis.read(data, 0, CHUNK_SIZE);
byte[] newImageData = new byte[imageData.length + CHUNK_SIZE];
System.arraycopy(imageData, 0, newImageData, 0, length);
System.arraycopy(data, 0, newImageData, length, readAmount);
imageData = newImageData;
length += readAmount;
}
fis.close();
finalConnection.close();
System.out.println("LENGTH IS " + length);
if (length > 0)
{
image = Image.createImage(imageData, 0, length);
}
}
else
{
System.out.println("NO PATH FOR IMAGE");
}
}
catch (Exception e)
{
System.out.println("Image.createImage(imageData, 0, length) " +e.toString());
}
catch(Error e)
{
System.out.println("Image.createImage " + e);
}
점이다. 며칠 동안이 물건에 붙어 있습니다. S40 장치에서 일하고 있습니다. Nokia 311. Netbeans MIDP 2.0