为什么自定义信息窗口谷歌地图V2的,不加载URL图像? [英] Why Custom InfoWindow of google map v2 ,Not load url Image?

查看:114
本文介绍了为什么自定义信息窗口谷歌地图V2的,不加载URL图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用谷歌地图V2,在应用程序开发的应用程序,还有自定义信息窗口,这是不加载(通过图像装载机装)从URL图像信息请见附件图片了解更多间隙。
          我的code是在这里 -

I am developing app using Google map v2,In app,there is custom info window,which is not loading image from URL (loading by image Loader) please see attached image for more clearance. My code is here-

public class CustomWindowAdapter implements InfoWindowAdapter {
private Activity objactivity;
private List<GroupDealModle> mapList;

public CustomWindowAdapter(Activity objactivity,
        List<GroupDealModle> mapList) {
    this.objactivity = objactivity;
    this.mapList = mapList;
}

@Override
public View getInfoContents(Marker objmarker) {
    return null;
}

@Override
public View getInfoWindow(Marker objmarker) {
    View objview  = render(objmarker);
    return objview;
}

private View  render(Marker objmarker) {
    ImageLoader objloader = new ImageLoader(objactivity);
    View view = null;
    if (!objmarker.getTitle().equals("")) {
        int pos = Integer.parseInt(objmarker.getTitle());
        Log.e("==check position==", "" + pos);
        if (mapList != null && mapList.size() > pos) {
            String countvalue = mapList.get(pos).getCount();
            Log.e("==check count==", "" + countvalue);
            if (countvalue.equalsIgnoreCase("1")) {
                LayoutInflater inflater = (LayoutInflater) objactivity
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                view = inflater.inflate(R.layout.balloon_overlay, null, false);
                TextView objbusname = (TextView) view
                        .findViewById(R.id.balloon_item_title);
                TextView objballoon_item_desc = (TextView) view
                        .findViewById(R.id.balloon_item_desc);
                TextView objtitle = (TextView) view
                        .findViewById(R.id.balloon_item_snippet);
                ImageView objimgview = (ImageView) view
                        .findViewById(R.id.userthumb_inbaloon);
                TextView objtextexpired = (TextView) view
                        .findViewById(R.id.textexpired);

                objbusname.setText(mapList.get(pos).getBussiness_name());
                String expirevalue = mapList.get(pos).getExpire_status();
                if (expirevalue != null && expirevalue.equals("1")) {
                    objtextexpired.setVisibility(View.VISIBLE);
                }
                if (expirevalue != null && expirevalue.equals("0")) {
                    objtextexpired.setVisibility(View.GONE);
                }

                objtitle.setText(mapList.get(pos).getDeal_title());
                objballoon_item_desc.setText(mapList.get(pos)
                        .getDescription());
                String imageurl = mapList.get(pos).getImage();
                objloader.DisplayBanner(AppConstants.BASE_URL + imageurl,
                        objimgview, 65, 65);
            } else {
                LayoutInflater inflater = (LayoutInflater) objactivity
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                view = inflater.inflate(R.layout.transparentview, null, false);
                view.setVisibility(View.GONE);
                String userid = mapList.get(pos).getUser_id();
                LatLng objlatlng = objmarker.getPosition();
                double latitude = objlatlng.latitude;
                double longitude = objlatlng.longitude;
                Bundle objbundle = new Bundle();
                Intent objintent = new Intent(objactivity,
                        com.flashdeal.map.MapGroupData.class);
                objbundle.putString("from", "map");
                objbundle.putString("lat", "" + latitude);
                objbundle.putString("longi", "" + longitude);
                objbundle.putString("userid", "" + userid);
                objintent.putExtras(objbundle);
                objactivity.startActivity(objintent);
            }
        }
    }
    return view;

}

}

从服务器下载像数据后,该适配器调用 -

this adapter call after data downloaded from server as like-

@Override
    protected void onPostExecute(List<GroupDealModle> result) {
        if (objprogress.isShowing()) {
            objprogress.dismiss();
        }
        if (result != null) {
            mapList = result;
            myMap.setInfoWindowAdapter(new CustomWindowAdapter(MainActivity.this,mapList));

            if (result.size() != 0) {
                if (result != null) {
                    addPins(result);
                }
            } else if (frommovecurrent != null
                    && frommovecurrent.equalsIgnoreCase("yes")) {
                frommovecurrent = "no";
                addSingleMarker();
                addPins(result);

                /*
                 * // objLayout . removeAllViews (); // objLayout .addView(
                 * objviewformap ); objMapViewhelper . clearMap( );
                 * AlertDialog .Builder objbuilder = new AlertDialog
                 * .Builder( MainActivity .this); objbuilder . setMessage (
                 * "No deals found" ); objbuilder . setPositiveButton ("ok",
                 * new DialogInterface . OnClickListener () {
                 * 
                 * @Override public void onClick( DialogInterface arg0, int
                 * arg1) { } }); objbuilder . create(); objbuilder .show();
                 */
            } else if (result.size() == 0) {
                addSingleMarker();
                addPins(result);
            }
        }

    }

我看到这个计算器讨论

I have seen this stackoverflow discussion

<一个href=\"http://stackoverflow.com/questions/14334390/android-google-maps-apiv2-infowindow-and-markers\">Android谷歌地图信息窗口APIv2和标记

但解决不了我的问题请人指导我。

but unable to solve my problem please anyone guide me.

推荐答案

该地图V2用户界面实际上是由另一个进程呈现。你不能修改查看您使用您的信息窗口中,您传递查看来映射V2之后。我的猜测是,你正在试图建立查看然后的加载图像以后,那是行不通的。获取图像,然后再放入查看你给之前的查看到地图V2。

The Maps V2 UI is actually rendered by another process. You cannot modify the View you use for your info window after you pass that View to Maps V2. My guess is that you are trying to set up the View, then load the image later on, and that will not work. Get the image first, then put it into the View before you give the View to Maps V2.

这,当然,浑身上下,您链接到答案。

This, of course, was covered in the answer that you linked to.

这篇关于为什么自定义信息窗口谷歌地图V2的,不加载URL图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆