0

I've a social networking app for android in which i can view list friends after fetching from java server +mySql database, actually i have done with loading all information from Java Servlets to android client but i'm unable to load images which are stored as blob in mysql on the server side database.

I tried to send blob objects to android client as strings and then tried to convert them in bitmap at the android client side. but I could not do what i wanted.. :(

Can anyone suggest me how to do it?

W.S
  • 931
  • 1
  • 10
  • 36

1 Answers1

1

I think a viable solution is to put a simple blob servlet capable to send a image/your_image_format response via HTTP. This way you can easily download/decode the Bitmap in your Android client from the servlet response, then set it as your ImageVIew source.

a.bertucci
  • 12,142
  • 2
  • 31
  • 32
  • Can you please tell me the way to do that. any example code for server & client side will be appreciated. – W.S Apr 22 '12 at 22:05
  • For the servlet code you can follow the link in my previous post (click on blob server). For the `Bitmap` download/decode stuff you can take a look [here](http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by-url-in-android) or [here](http://stackoverflow.com/questions/3118691/android-make-an-image-at-a-url-equal-to-imageviews-image) – a.bertucci Apr 22 '12 at 22:13
  • What if i also want to send some textual information along with picture, for example name, age, gender etc.. Which will be part of user profile to be appeared along with picture.. Thanks. – W.S Apr 22 '12 at 22:15
  • I think merging image with other stuff in the same response is not a wise solution. You can serve additional infos via a dedicated servlet. The format of its response is up to you (ie: JSON, XML, etc.) – a.bertucci Apr 22 '12 at 22:24
  • Sorry but I can't get the sense of your last comment. Please make it more clear or try to elaborate on that. – a.bertucci Apr 22 '12 at 22:27
  • Thank you mr_archano for your help. I'll try it again later. – W.S Apr 22 '12 at 22:33