I'm trying to create custom markers for android map. I'm using IconGenerator from Google Utility. My custom marker includes a ParseImageView (image view from Parse SDK).
This is the code for the custom marker.
This is inside my function generateRichMarkerIcon
IconGenerator iconGenerator = new IconGenerator(getContext());
ParseImageView imageView = new ParseImageView(getContext());
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new ViewGroup.LayoutParams(70, 70));
imageView.setParseFile(imageFile);
imageView.loadInBackground();
iconGenerator.setContentView(imageView);
if (selected) {
iconGenerator.setColor(Color.BLUE);
}
return BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon());
And then I use it like this
BitmapDescriptor icon = generateRichMarkerIcon(false, card);
Marker marker = this.googleMap.addMarker(new MarkerOptions()
.icon(icon)
.position(new LatLng(lat, lng)));
Still, I can't see the image, but a blank marker (size is fine, 70x70) without image view inside.
This is a screenshot: https://drive.google.com/file/d/1-t5FOrKotac5YMfNoLbZo1NFjEFGpqtg/view?usp=sharing
What is wrong with this code?