I have been struggling the past few days with loading an image inside an infowindow in google maps. I believe I am not referencing the url from parse correctly. Can anyone please help me or guide me on how to get the parse image into the infowindow? this is the snippet for that code. (NOTE) I can load an image into the infowindow with resources but not from parse. (I beliebe the problem is I am not referencing the right item) Thanks in advance.
PS: This line of code: imgUrl cannot be resolved to a symbol
@Override
public void onMapReady(final GoogleMap googleMap) {
googleMap.setMyLocationEnabled(true);
this.googleMap = googleMap;
googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
// Use default InfoWindow frame
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
// Defines the contents of the InfoWindow
@Override
public View getInfoContents(Marker marker) {
//icon.setImageResource(R.mipmap.back_vision_fade);
ParseQuery<ParseObject> query = ParseQuery.getQuery("Places");
View v = getActivity().getLayoutInflater().inflate(R.layout.maps_infowindow, null);
v.setLayoutParams(new LinearLayout.LayoutParams((int) (mapFragment.getView().getMeasuredWidth() * .9), LinearLayout.LayoutParams.WRAP_CONTENT));
((TextView) v.findViewById(R.id.title)).setText(marker.getTitle());
((TextView) v.findViewById(R.id.desc)).setText(marker.getSnippet());
ImageView icon = (ImageView) v.findViewById(R.id.imageView5);
Item item = new Item();
try {
List<ParseObject> objects = query.find();
for(ParseObject obj : objects){
ParseGeoPoint point = obj.getParseGeoPoint("location");
if(obj.getParseFile("icon")!=null) {
item.setIcon(obj.getParseFile("icon").getUrl());
//item.downloadIcon(context);
item.setIcon(obj.getParseFile("icon").getUrl());
Picasso.with(getActivity()).load(imgUrl).into(icon, new MarkerCallback(marker));
}
}
} catch (ParseException e) {
}
return v;
}
}
);
Aucun commentaire:
Enregistrer un commentaire