title: Android getting pictures from webservice, how to?
body: <p>I have an android application that needs to receive several pictures from the webservice.
  But how to do this?</p>
  
  <p>In my webservice i'm currently sending only 1 image as a byte[].</p>
  
  <pre><code>public static byte[] GetMapPicture(string SeqIndex)
      {
          try
          {
              byte[] maps;
              InterventionEntity interventie = new InterventionEntity(long.Parse(SeqIndex));
              MyDocumentsCollection files = interventie.Location.MyDocuments;
              maps = null;
              foreach (MyDocumentsEntity file in files)
              {
                  if (file.SeqDocumentType == (int)LocationDocumentType.GroundPlanDocument &amp;&amp; file.File.Filename.EndsWith(".jpg"))
                      maps = (file.File.File);
              }
              return maps;
          } catch (Exception e) {
              Log.Error(String.Format("Map not send, {0}", e));
              return null;
          }
      }
  </code></pre>
  
  <p>The byte[] is returned from my webservice.
  But in my android project the bitmap is not decoded and therefor null.</p>
  
  <pre><code>public Bitmap getPicture(String message, String url, Context context) throws IOException{
       HttpClient hc = MySSLSocketFactory.getNewHttpClient();
       Log.d(MobileConnectorApplication.APPLICATION_TAG, "NETWORK - Message to send: "+ message);
       HttpPost p = new HttpPost(url);
       Bitmap picture;
      HttpParams httpParams = new BasicHttpParams();
      HttpConnectionParams.setSoTimeout(httpParams, threeMinutes );
      p.setParams(httpParams);
  
       try{
          if (message != null)
              p.setEntity(new StringEntity(message, "UTF8"));
       }catch(Exception e){
           e.printStackTrace();
       }
       p.setHeader("Content-type", "application/json");
  
       HttpContext httpcontext = new BasicHttpContext();
      httpcontext.setAttribute(ClientContext.COOKIE_STORE, MobileConnectorApplication.COOKIE_STORE);
      try{
           HttpResponse resp = hc.execute(p,httpcontext);
           InputStream is = resp.getEntity().getContent();
  
           picture = BitmapFactory.decodeStream(is);  //here is goes wrong
           int httpResponsecode = resp.getStatusLine().getStatusCode() ;
           checkResponse(url, message, "s", httpResponsecode);
           Log.d(MobileConnectorApplication.APPLICATION_TAG, String.format("NETWORK - Response %s", httpResponsecode));
  
      } finally{
  
      }
       return picture;
   }
  </code></pre>
  
  <p>Can anyone help me on this?</p>