I wonder how you should do if you are going to convert an String that contains an array of bytes, actually bytes from an image into an byte array.
I guess this is a pretty common issue so i guess someone could give any suggestions.
If it is better to convert an JSONArray into an byte array i would like to know why.
It depends on how you’ve constructed the string in the first place. If something somewhere has used
then you’ve already lost information, potentially. Image data isn’t text.
To propagate opaque binary data in text, you should use base64 (or potentially hex). Android already has a
Base64class that makes this easy:EDIT: If you can’t use that class, this public domain base64 encoder should work fine.