开发者

Show the listview item clicked location on google map

开发者 https://www.devze.com 2023-04-08 08:56 出处:网络
I have created an application which shows the multiple overlay as the result of search button click ,there is one more button result list ,which open a dialog box with list view having the details of

I have created an application which shows the multiple overlay as the result of search button click ,there is one more button result list ,which open a dialog box with list view having the details of those search result overlays... I have created a button on the list item "show on the map" ,now i want when the user click on that button the dialog will dismiss and map-view animate to that particular overlay ..

I tried this code ,but it is not working:

   Button.OnClickListener mOkOnClickListener1 = new Button.OnClickListener()
        {
            public void onClick(View v) {
                dialog2.dismiss();
                                  String list_lat = ""+data.get(position).get("lat");
                                  String list_lon =  ""+data.get(position).get("lng");
                                  System.out.println("show map..."+list_lat +list_lon);



                                  GeoPoint point = new开发者_C百科 GeoPoint( (int) Double.parseDouble(list_lat),
                                          (int) Double.parseDouble(list_lon));

                                    mapController.animateTo(point);
                                    mapController.setZoom(14);
                                    mapView.postInvalidate(); 


            }
        };
        btn_sm.setOnClickListener(mOkOnClickListener1); 

Thanks in advance..!!


My problem is solved after multiplying 1E6 in the latitude and longitude :

  GeoPoint point = new GeoPoint( (int)( Double.parseDouble(list_lat)* 1E6),
                                          (int) (Double.parseDouble(list_lon)* 1E6));

I am posting this because it may help to others,facing the same problem....

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号