I have a C# web service that gets data from a MS SQL database and sends it to an Android device as a XML string.
I then parse the XML in Android and store the data in an Android database
This works fine for all string and integer data but I can't get a byte array (which is used to store an image) to work in same way
My C# code to add the byte array to XML looks like this:
XmlElement ImageStored = (XmlElement)StockItem.AppendChild(doc.CreateElement("ImageStored"));
ImageStored.InnerText = Convert.ToBase64String(stockItem.ImageStored);
And in Android i have tried this:
NodeList nImageStored = doc.getElementsByTagName("ImageStored");
for(int i = 0; i < nImageStored.getLength(); i++)
{
byte[] pImageStored = nImageStored.item(i).getFirstChild().getNodeValue().trim().getBytes();
//save byte[] in database
}
This is not giving me any errors and does save something in the database, but when it comes to displaying the image nothing appears.
Any help on how to get this working would be great. This is the first time I have tried working with C# and Android together so forgive me if I am being stupid.
Thanks!