Question

I'm creating an android application that receive texts from a windows application via TCP/IP. It works fine but now I am trying to send images over. Images are converted to bytearray and sent through TCP/IP. On the receiving end however, I have to differentiate the bytearray from a normal string of text with an if/else statement in order to convert the bytearray into an image and display text messages as they are. Anyone have any idea on how to do this?

Was it helpful?

Solution

In many applications i encountered images being stored e.g. in xml as base64 encoded. Or you may want to introduce a header information (in simple case a header byte or similar) to both String and image, which you can work your if/else on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top