开发者

Unable to find a Location Dynamically in Google-Map

I am facing a problem with the google map search. I have mad a app through which i can see a location in google map on my emulator which is set in the code as:

int lat = (int)(22.3666667*1000000);
int lng = (int)(91.8000000*1000000);
GeoPoint pt = new GeoPoint(lat,lng);

This works fine. Now i want to search a location dynamically i开发者_如何学Python.e. i have a editbox(Location_For_Search) and a button(Find_Location_Button). So when i write some location in editbox and press the button then it will show the location in google map with a marker on location. How can i do this? Please any one help me.

With best wishes Md. Fazla Rabbi


Use the geocoder:

Geocoder geo = new Geocoder(this);

List<Address> addr;

try 
{
        addr = coder.getFromLocationName(yourEditTextaddr, 10);

        Address loc = addr.get(0);
        loc.getLatitude();
        loc.getLongitude();

        point = new GeoPoint((int) (loc.getLatitude() * 1E6),
                    (int) (loc.getLongitude() * 1E6));

        return point;
 }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜