2011-01-01 7 views
0

내가 정의 drawListRow에 이미지를 얻을 관리했습니다 drawListRow 정의에서 사라지고 이미지 다시 사진이 사라졌습니다. 제안 사항이 있으십니까?블랙 베리 :

편집 :이 코드를 통해 두 번째 시간을 알아 냈어요 :

try { 
     InputStream inputStream = Connector.openInputStream(ImagePath); 

     ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); 
     int i = 0; 
     while ((i = inputStream.read()) != -1) { 
      outputStream.write(i); 
     } 

     byte[] data = outputStream.toByteArray(); 
     EncodedImage eimg = EncodedImage.createEncodedImage(data, 0, 
       data.length); 
     Bitmap image = eimg.getBitmap(); 
     inputStream.close(); 
     outputStream.close(); 

     return ImageUtility.resizeBitmap(image, 70, 70); 
    } catch (IOException e) { 
     return null; 
    } catch (IllegalArgumentException ex) { 
     return null; 
    } 
} 

하는 InputStream inputStream = Connector.openInputStream(ImagePath);는 IOException를 던지고있다. 나는 here 에서 IO가 다음 조건에서 throw 될 것이라고 이해합니다. 그러나 원인을 알 수는 없습니다 : 1. fileconnection의 단일 인스턴스에서 둘 이상의 openInputStream(). 2. 이미 닫힌 파일 연결에 대한 openInputStream(). 3. 디렉토리의 openInputStream()입니다.

다시 제안 사항이 있으십니까?

답변

0

완전 배열 된 이미지의 개별 배열을 작성하고 그 배열과 thing 배열을 모든 행을 그릴 때마다 형식화하고 그리는 대신 drawlistrow에 전송하는 것이 가장 좋습니다.