Bitmap'i String'e dönüştürebilir miyim? Ve sonra Dizeyi Bitmap'e geri dönüştürün?Bitmap'i Dize Dönüştür
Şimdiden teşekkürler.
Bu iki işlemin nasıl gösterir:
Bitmap'i String'e dönüştürebilir miyim? Ve sonra Dizeyi Bitmap'e geri dönüştürün?Bitmap'i Dize Dönüştür
Şimdiden teşekkürler.
Bu iki işlemin nasıl gösterir:
This kodu bir dizeye dönüştürmek istediklerini görünmektedir How to convert a Base64 string into a BitMap image to show it in a ImageView?
Ve bu bir .bmp geri dönüştürme gösterir: Android code to convert base64 string to bitmap
Google, arkadaşın ... her zaman cevabını biliyorsa arkadaşlarına sormalısın :)
Steve
herhangi bir dosya biçimi
public String photoEncode(File file){
try{
byte[] byteArray = null;
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[1024*8];
int bytesRead =0;
while ((bytesRead = bufferedInputStream.read(b)) != -1)
{
bos.write(b, 0, bytesRead);
}
byteArray = bos.toByteArray();
bos.flush();
bos.close();
bos = null;
return changeBytetoHexString(byteArray);
}catch(Exception ex){
ex.printStackTrace();
return null;
}
}
private String changeBytetoHexString(byte[] buf){
char[] chars = new char[2 * buf.length];
for (int i = 0; i < buf.length; ++i)
{
chars[2 * i] = HEX_CHARS[(buf[i] & 0xF0) >>> 4];
chars[2 * i + 1] = HEX_CHARS[buf[i] & 0x0F];
}
return new String(chars);
}
bu cevabı oku: base64 dize dönüştürmek için http://stackoverflow.com/questions/4041849/string-to-bitmap-java-android [Android kod – Adnan
olası yinelenen bitmap] (http://stackoverflow.com/questions/3801760/android-code-to-convert-base64-string-to-bitmap) –
http://stackoverflow.com/questions/4837110/how-to sayfasının olası kopyası -convert-a-base64-string-içine-bir-bitmap-resme-göstermek-in-a-imageview –