이진 데이터가있는 .txt 파일이 있습니다.이 데이터를 바이트 배열에 넣고이 배열의 이미지를 표시하려고합니다. 필자는이 코드를 사용하여, 나는비트 맵을 사용하여 바이트 배열에서 이미지 표시
FileInputStream inputStream;
OutputStream out = null;
int bytesRead=0;
try{
inputStream = new FileInputStream(file4.getPath());
byte[] result = new byte[320*256*2];
bytesRead = inputStream.read(result);
Bitmap bmp = BitmapFactory.decodeByteArray(result, 0, result.length);
ImageView image = (ImageView) findViewById(R.id.imageDisplay);
image.setImageBitmap(bmp);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
컴파일에서도 실행에 오류가없는 ... 거기에 실수가 있지만 임없는 전문가 그래서 비트 맵 알고있는,하지만 난 클릭하면 버튼 이미지를 표시하기에 나는이 있습니다
SkImageDecoder::Factory returned null
이 도움을 주셔서 감사합니다 코드에서이 변경을 할
'이진 데이터가있는 .txt 파일이 있습니다.' 그것을 위해 .txt 파일을 남용하지 마십시오. 모두는 일반 텍스트 만 기대합니다. – greenapps
이 바이너리 데이터가 어떻게 인코딩되는지 알 수 있습니다. 또는 youdid가 어떻게 입력했는지 보여줄 수 있습니다. – greenapps
'SkImageDecoder :: Factory returned null'. 코드에는 SkImageDecoder가 없습니다. BitmapFactory 만 있습니다. 그래서 요점을 지키십시오. – greenapps