java - Sending PNGs via PHP web to an Android App -


what's best way pass png image php android app in java?

i tried in php:

$archi=file_get_contents("bar.png"); $archi2=base64_encode($archi); print($archi2); 

and in java:

string img= base64.decode(str); byte[] bytearray = img.getbytes(); bitmap mybitmap=bitmapfactory.decodebytearray(bytearray,0,bytearray.length); 

but get:

skimagedecoder::factory returned null

solved, de base64 decoding string , bytearray. decoding directly bytearray using following class worked:

class: https://grizzly.java.net/docs/2.3/xref/org/glassfish/grizzly/http/util/base64utils.html

java code:

byte[] bytea = base64.decode(downloadedstr); imagen=bitmapfactory.decodebytearray(bytea,0,bytea.length); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -