I'm uploading a String bitmap as "User profile image". The upload to the server using php is all good, and the download from the server too. The thing is when I'm looking in the bitmap String I see little differences between the 2 bitmaps and I can decode the one I have downloaded. IDK if i'm managing the String in the correct way.
String bitmap I'm sending : 1
String bitmap I receive (pic in comments, i can't put more than 1 link here) [2]
code to receive my string from the php:
StringBuilder sb = new StringBuilder();
reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line + "");
}
line = sb.toString();
String[] kvPairs = line.split(",");
Once I split the line by the commas: (im receiving smth like"name":"john","age"="5",...,"bitstringImag"="/9j/4AA.." )
Im getting the Bitmap String value:
String[] bitmstrIn = kvPairs[5].split(":"); //separating the key from the value
String[] bitmstrIn2 = bitmstrIn[1].split("\\}"); //erasing last key in the String
String bitStr = bitmstrIn2[0].replaceAll("\"", ""); //removing the added (i dont know why) backslash.
String biStrFin = bitStr.replaceAll("\\\\","");//removing the added (i dont know why) backslash.
and the result in bitStrFin is the one I pasted in to the comments.
If you know any better way to do it, please tell me i've been fighting to this for a long time! Thanks for the help guys