Reputation: 535
I have image in the as a string and it is in the form:
�����JFIF���������C�
%# , #&')*)-0-(0%()(���C
(((((((((((((((((((((((((((((((((((((((((((((((((((�����"��������������������������������������N���H3�ӗ�2g�?^Ia���a�$��tsE�����
���u]y�ڻ�a�X�B��Xah����v
èV^z@�)t����
��u��THf� !�$���X$���$`!�VZUe V$0��#���HL�ue�y $I$� �)$),�տE9v�Í�V��벿G�n�!@*�*�h�tz�oO�oB�n�z��q�n�"k��v�=�����y��������ߐ<�tp�����H@�[V� ���d��YQ��+Hzk��$���eɳ'Lb��{p��$�&���mVƛ鿗{�8�U�O^y벿G�H.`1V���rz�|���6Q��m|{�o:�u���y��u��&.�=�cU�vu疭���5W����!����BA]Vר��V2�FH�H@@�Yh��!����bd$V\��u�*n��$HA���6B -��E��ǽ�&7]7S۞z�;�H��l���^�>wұ��s�o�]�崽1Xj�5����(���6~�9o7M�l�u���Sn��{���9>��.pd��@V��ʵ�ej���C%B����+zk+��!�!"����מ*n��$�BCY$)!�m��Ѣ�{����;r�]���!/G������x����&Ʈ���W]��-��e��V�_�����lH!s�Q�e�b:y�cD�י����+J#�aUUmz�l�t|�$�"@%���ebIMmv0��H��\{1�犫+��h���
my question is how should I load this into ImageView? I have tried converting into byte array and then into bitmap and loading it but nothing has worked
Upvotes: 1
Views: 143
Reputation: 93561
You wouldn't hold an image as a string like that- with unicode and different text encodings you're asking for problems. If you absolutely HAVE to do it (and it should be avoided if at all possible), it should be encoded as Byte64, not used as raw bytes. You would then decode that into a byte array, the byte array into a bitmap, and the bitmap into a bitmap drawable for the image view.
Upvotes: 3