I'm developing application using google map. and I need custominfowindow that has two of text, and image source.
it's my infocontents() code. using firebase, Google map, Glide but it's does not work plz help.
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
final View v = getLayoutInflater().inflate(R.layout.custom_window, null);
infoWindowProfile = (CircleImageView) v.findViewById(R.id.ci_custom_profile);
infoWindowPr = (TextView) v.findViewById(R.id.tv_custom_pr);
String uidTemp = marker.getSnippet();
Log.d("markerproper", "uid(snippet) : " + uidTemp);
database = FirebaseDatabase.getInstance();
markerRef = database.getReference().child("truck").child(uidTemp);
markerRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Map<String, ZariPosts> zariPost = (Map<String, ZariPosts>) dataSnapshot.getValue();
markerProfileUrl = String.valueOf(zariPost.get("profileUrl"));
markerPr = String.valueOf(zariPost.get("pr"));
Log.d("markerproper", "uid(markerProfileUrl) : " + markerProfileUrl);
Log.d("markerproper", "uid(markerPr) : " + markerPr);
Glide.with(SearchActivity.this)
.load(markerProfileUrl)
.centerCrop()
.into(infoWindowProfile);
infoWindowPr.setText(markerPr);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
return v;
}
from https://github.com/bumptech/glide/issues/290
you can try adding the following into your getInfoContent() method. change the url and imageView name accordingly.
Glide.with(mContext).load(imageURL).asBitmap().override(50,50).listener(new RequestListener<String, Bitmap>() {
@Override
public boolean onException(Exception e, String model, Target<Bitmap> target, boolean isFirstResource) {
e.printStackTrace();
return false;
}
@Override
public boolean onResourceReady(Bitmap resource, String model, Target<Bitmap> target, boolean isFromMemoryCache, boolean isFirstResource) {
if(!isFromMemoryCache) marker.showInfoWindow();
return false;
}
}).into(imageView);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With