bring an image from sql server to android

0

good afternoon people, the consultation, basically it is, I have an image in a sql server database (varbinary), and I bring it through a json with a restful service done with node, along with other data; when I bring it from the json, I treat it as a string because it is the only format I know of to take it to an intermediate entity. the question is that I try to convert it to base64, and then transform it into a byte [] but it throws conversion error, will there be any other way to do it?

the method I use is the following:

byte[] decodeString = new byte[0];
            try {
                decodeString = Base64.decode(i.getImagen(), Base64.NO_OPTIONS);
            } catch (IOException e) {
                e.printStackTrace();
            }
            Bitmap decodebitmap = BitmapFactory.decodeByteArray(decodeString,
                   0, decodeString.length);
            imagen.setImageBitmap(decodebitmap);
    
asked by Pablo Ezequiel Ferreyra 09.01.2018 в 18:23
source

0 answers