我试图在用户单击标记时从自定义infoWindow中的URL加载图像.我能够加载其他细节,但图像没有加载它.我正在使用Picasso库为我这样做.我搜索了许多相关主题并查看了解决方案,但无法理解应用哪种解决方案来解决我的问题.我正在使用Web服务调用来获取所需的数据.
这是我的代码:
@Override
public View getInfoContents(Marker arg0) {
//marker.showInfoWindow();
return null;
}
@Override
public View getInfoWindow(Marker arg0)
{
View v = getLayoutInflater().inflate(R.layout.map_infowindow, null);
for(int i=0 ; i<lstMain.size();i++)
{
Pojo b=lstMain.get(i);
double slat= Double.parseDouble(b.getLatitude());
double slng= Double.parseDouble(b.getLongitude());
double lat= Math.round(slat*100000.0)/100000.0;
double lng= Math.round(slng*100000.0)/100000.0;
String s1=String.valueOf(lat);
String s2=String.valueOf(lng);
Log.v("comparing latilongi pojo===>", lat+" , "+lng);
Log.v("comparing latilongi marker===>", Clickedlatitude+" , "+Clickedlongitude);
if(s1.equals(String.valueOf(Clickedlatitude)) && s2.equals(String.valueOf(Clickedlongitude)))
{
txtDname=(TextView)v.findViewById(R.id.infoDoctorName);
txtDspe=(TextView)v.findViewById(R.id.infoDoctorSpe);
txtDaddress=(TextView)v.findViewById(R.id.infoDoctorAddress);
imgUrl=(ImageView)v.findViewById(R.id.infoDoctorImage);
String url=b.getPhotoURL();
txtDname.setText(b.getDoctorName());
txtDspe.setText(b.getSpecialization());
txtDaddress.setText(b.getAddress1()+" , "+b.getAddress2());
Picasso.with(MapActivity.this)
.load(url)
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher).resize(50, 50)
.into(imgUrl);
} …
Run Code Online (Sandbox Code Playgroud)