c# - Xamarin Android passing data from class to activity -
i made web api xamarin android app. , pass through data web api android using json (jarray). , filled class json data, i'm not sure how data class android activity.
codes: requesting jarray in web api activity, , convert class made.
webclient request = new webclient(); uri uri = new uri("http://iphere/database/api/surfboards/getsurfboards"); string surfboardsstring = request.downloadstring(uri); jarray thearray = jarray.parse(surfboardsstring); surfboard[] surfboard = (surfboard[])jsonconvert.deserializeobject(thearray.tostring());
this surfboard.cs (class)
class surfboard { public string name { get; set; } public double price { get; set; } public string type { get; set; } public byte[] picture { get; set; } public string description { get; set; } }
and have question, can upload image gets converted byte array json, how can turn image if byte array in android app?
thanks!
as variables in class in public can values object values set name.
surfboard sb= new surfboard(); // set values of sb/// //// // values of sb string name=sb.name;
answer second question : can turn byte array image following.
bitmap bitmap = bitmapfactory.decodebytearray(bytearray , 0, bytearray .length);
Comments
Post a Comment