Php 安卓谷歌地图lat/long

Php 安卓谷歌地图lat/long,php,android,google-maps-api-2,Php,Android,Google Maps Api 2,我正在编写一个应用程序,将输入的地址转换为lat/long坐标,然后在地图上显示给用户。一切都很顺利,除了我的坐标显示为。。35429885,-9745332 .. 您可以看到,没有周期来定义它们。我需要他们像这样出来。。35.429885,-97.45332,以便google maps api显示标记。有没有办法输入句点,或者我的代码有什么问题?下面是我用来将地址转换为lag/long的代码。提前谢谢 geocoder = new Geocoder(this); EditText local

我正在编写一个应用程序,将输入的地址转换为lat/long坐标,然后在地图上显示给用户。一切都很顺利,除了我的坐标显示为。。35429885,-9745332 .. 您可以看到,没有周期来定义它们。我需要他们像这样出来。。35.429885,-97.45332,以便google maps api显示标记。有没有办法输入句点,或者我的代码有什么问题?下面是我用来将地址转换为lag/long的代码。提前谢谢

geocoder = new Geocoder(this);

EditText locale = (EditText) findViewById(R.id.e_addy_text);  

String locationName = locale.getText().toString();

            try
            {
                List<Address> addressList = geocoder.getFromLocationName(  
                    locationName, 5); 

                if (addressList != null && addressList.size() > 0) 
                {  
                    lat = (int) (addressList.get(0).getLatitude() * 1e6);  
                    lng = (int) (addressList.get(0).getLongitude() * 1e6); 

                    // CONVERT TO STRING
                    e_lat = Integer.toString(lat);
                    e_lng = Integer.toString(lng);

                    // input into my database.
                }
                else
                {
                    // toast saying invalid address
                }
            } 
            catch (Exception e) 
            {  
                e.printStackTrace();  
            }
geocoder=新的geocoder(本);
EditText语言环境=(EditText)findViewById(R.id.e_addy_text);
String locationName=locale.getText().toString();
尝试
{
List addressList=geocoder.getFromLocationName(
地点名称,5);
if(addressList!=null&&addressList.size()>0)
{  
lat=(int)(addressList.get(0.getLatitude()*1e6);
lng=(int)(addressList.get(0.getLongitude()*1e6);
//转换为字符串
e_lat=整数。toString(lat);
e_lng=整数。toString(lng);
//输入到我的数据库。
}
其他的
{
//吐司说地址无效
}
} 
捕获(例外e)
{  
e、 printStackTrace();
}

您已将lat long存储为整数,必须将其存储为double

并返回具有十进制表示的double值。 在这个例子中,您将双精度转换为int

只需将值存储在双变量中,然后转换为字符串

double lat=addressList.get(0).getLatitude();

double lon=addressList.get(0).getLongitude();
转换为字符串

 e_lat=  String.valueOf(lat);
 e_lng  String.valueOf(lon);

这个答案很完美。。谢谢。