繁体   English   中英

字符串到byte []的解码错误:找不到适合的解码(byte [])方法

[英]String to byte[] decoding error: no suitable method found for decode(byte[])

我将Bitmap解码为String并将ut放在SharedPreferences中
然后我把它放进PhotoEncoded
在这里,我想将其解码为byte [],但它显示了一个错误:

String PhotoEncoded = prefs.getString("AccountPhotoString",null);
              byte[] b = PhotoEncoded.getBytes();
              byte[] imageAsBytes = Base64.decode(b);//error

怎么了

我找到了解决方案

PhotoEncoded = prefs.getString("AccountPhoto",null);
          byte[] b = PhotoEncoded.getBytes();
          byte[] imageAsBytes = Base64.decode(b,Base64.DEFAULT);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM