Guest User

Untitled

a guest
Dec 16th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. private void addMarker(LatLng latLng, String gametitle, String privacy) {
  2. if (privacy.matches("Public")){
  3. MarkerOptions Eventsmarkers = new MarkerOptions();
  4. Eventsmarkers.position(latLng);
  5. Eventsmarkers.title(gametitle);
  6. int px = getActivity().getResources().getDimensionPixelSize(R.dimen.map_marker_diameter);
  7. View markerView = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.map_marker_card, null);
  8. markerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  9. markerView.layout(0, 0, px, px);
  10. markerView.buildDrawingCache();
  11.  
  12. TextView eventTitle = (TextView)markerView.findViewById(R.id.editTextEventName);
  13. Bitmap mDotMarkerBitmap = Bitmap.createBitmap(px, px, Bitmap.Config.ARGB_8888);
  14. Canvas canvas = new Canvas(mDotMarkerBitmap);
  15. eventTitle.setText(gametitle);
  16. markerView.draw(canvas);
  17. Eventsmarkers.icon(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap));
  18. Eventmarker= mMap.addMarker(Eventsmarkers);
  19. }
  20. }
Add Comment
Please, Sign In to add comment