title: Android add marker to maps v2 with setIcon from url
body: <p>Before asking this question, I reviewed many links</p>
  
  <p>I'm parsing an xml from a web, and from this xml, get the longitude, latitude and name for a marker that I add to my map (v2) on android app</p>
  
  <p>so far everything works perfectly.</p>
  
  <pre><code>mMap.addMarker(new MarkerOptions()
                  .position(new LatLng(dLat, dLon)) // lat and lon from the xml of the web
                  .title(NAME_OF_MARKER));
  </code></pre>
  
  <p>This xml also includes a field with the url of the small image to display the marker</p>
  
  <pre><code>&lt;marker&gt;
  &lt;lat&gt;40.758895&lt;/lat&gt;
  &lt;lon&gt;-73.985131&lt;/lon&gt;
  &lt;name&gt;My Point&lt;/name&gt;
  &lt;thumb&gt;http://research.cbei.psu.edu/images/uploads/research-digest/general/1.CityIcon.png&lt;/thumb&gt;
  &lt;/marker&gt;
  </code></pre>
  
  <p>I understand that the image of the xml should be loaded into a BitMap, and this BitMap put it as marker icon:</p>
  
  <pre><code> mMap.addMarker(new MarkerOptions()
                  .position(new LatLng(dLat, dLon))
                  .title(NAME_OF_MARKER))
                  .setIcon(BitmapDescriptorFactory.fromBitmap(bmp));
  </code></pre>
  
  <p>I am using an AsyncTask to load the url and assign it to a bitmap:</p>
  
  <pre><code>    Bitmap bmp;
      Canvas canvas1;
  
      //...
   public class markers extends AsyncTask&lt;String, Void, String&gt; {
  
       protected void onPreExecute() {
  
                Bitmap.Config conf = Bitmap.Config.ARGB_8888;
                bmp = Bitmap.createBitmap(80, 80, conf);
  
            }
  
            public String doInBackground(String... urls) {
  
                      try {
                          URL url = new URL(MY_THUMB); //url of the image parser from the xml ("http://research.cbei.psu.edu/images/uploads/research-digest/general/1.CityIcon.png")
                          HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                          conn.setDoInput(true);
                          conn.connect();
                          InputStream is = conn.getInputStream();
                          bmp = BitmapFactory.decodeStream(is);
                      } catch (IOException e) {
  
                      }
          //...
  </code></pre>
  
  <p>... And before creating the marker on the map:</p>
  
  <pre><code>  canvas1 = new Canvas(bmp);
  
          Paint color = new Paint();
          color.setTextSize(35);
          color.setColor(Color.BLACK);
  
  //modify canvas
          canvas1.drawBitmap(bmp, 0, 0, color);
          canvas1.drawText("User Name!", 30, 40, color);
  
          mMap.addMarker(new MarkerOptions()
                  .position(new LatLng(dLat, dLon))
                  .title(NAME_OF_MARKER))
                  .setIcon(BitmapDescriptorFactory.fromBitmap(bmp));
      }
  </code></pre>
  
  <p>..but Never works.
  Everything loads fine, but never the icon is displayed.</p>
  
  <p>I have carefully read many threads related like this:</p>
  
  <p><a href="https://stackoverflow.com/questions/8992964/android-load-from-url-to-bitmap">Android load from URL to Bitmap</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11831188/how-to-get-bitmap-from-a-url-in-android">How to get bitmap from a url in android?</a></p>
  
  <p>But I get it working, of course I have included the necessary permissions in the manifest, internet, write external, etc, but without success.</p>
  
  <p>I would greatly appreciate any help, I have tested hundreds of ways.</p>
  
  <p>Greetings and thank you in advance</p>