Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top