2014-03-13 2 views
0
Bitmap foto = b.getBitmap(); 

byte[] bytes = null; 
ByteArrayOutputStream ba = new ByteArrayOutputStream(); 
foto.compress(Bitmap.CompressFormat.JPEG, 100, ba); 
foto.recycle(); 
foto = null; 

bytes = ba.toByteArray(); 

String bBytes = Arrays.toString(bytes); 

이 메서드는 Byte 값의 문자열을 반환하고 싶습니다. 예를 들어, 다음과 같습니다. "12,23,34 ....".바이트 배열을 문자열로 변환 - - Performace Android로

+0

여러분은 여러분의 질문을 먼저 __translate__하기를 기대합니까? – devnull

+0

나는 그의 질문에서 내가 이해 한 것을 고치려고 노력했다. – Manitoba

+0

이 방법으로 어떤 방법을 사용합니까?! – mok

답변

1

다음은 수행 방법입니다.

import java.util.Arrays; 

public class Test { 

    public static void main(String[] args) { 
     byte[] bytes = {1,2,3,12}; 
     String bBytes = Arrays.toString(bytes); 
     bBytes = bBytes.replaceAll(" ", ""); 
     bBytes = bBytes.replaceAll("\\[", ""); 
     bBytes = bBytes.replaceAll("\\]", ""); 
     System.out.println(bBytes);  
    } 

} 
+0

작은 비트 맵, 완벽한 작품,하지만 때와 큰 비트 맵,이 변환은 너무 오래, 이미 NDK로 일을 생각, 어쩌면 performace 우수합니다. 문제는 다음과 같습니다. String bBytes = Arrays.toString (bytes); – ISJ

+0

처음으로 성능 문제에 대해 언급합니다. 다른 질문을 올리면 제안 할 것입니다. –

+0

제안 할 수 있습니까? – ISJ

관련 문제