Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. Bitmap bmImg = imageLoader.loadImageSync(url);
  2.  
  3. 04-13 14:11:44.953: E/ImageLoader(18542): android.os.NetworkOnMainThreadException
  4.  
  5. public void drawPicsOnMap()
  6. {
  7. String title = null;
  8. String place = null;
  9. for (int i = 0; i<camera.size(); i++)
  10. {
  11. Bitmap.Config conf = Bitmap.Config.ARGB_8888;
  12. Bitmap bmp = Bitmap.createBitmap(80, 80, conf);
  13. Canvas canvas = new Canvas(bmp);
  14.  
  15. // paint defines the text color,
  16. // stroke width, size
  17. Paint color = new Paint();
  18. color.setTextSize(35);
  19. color.setColor(Color.BLACK);
  20.  
  21. Camera cam = camera.get(i);
  22. LatLng coord = new LatLng(cam.lat, cam.lon);
  23.  
  24. title = Integer.toString(cam.id);
  25. place = cam.place;
  26.  
  27. String url = cam.img;
  28. Bitmap bmImg = imageLoader.loadImageSync(url);
  29.  
  30. //modify canvas
  31. canvas.drawBitmap(bmImg, 0,0, color);
  32. canvas.drawText(title, 30, 40, color);
  33.  
  34. Marker mark = map.addMarker(new MarkerOptions()
  35. .position(coord)
  36. .title(title)
  37. .snippet(place)
  38. .icon(BitmapDescriptorFactory
  39. .fromBitmap(bmp)));
  40.  
  41. markers.put(mark.getId(), url);
  42. }
  43. }
  44.  
  45. imageLoader.loadImage(url, new SimpleImageLoadingListener(){
  46.  
  47. @Override
  48. public void onLoadingComplete(String imageUri, View view,
  49. Bitmap loadedImage) {
  50. super.onLoadingComplete(imageUri, view, loadedImage);
  51.  
  52. //write your code here to use loadedImage
  53. }
  54.  
  55. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement