This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Android and the fly likes how to get a longitude & latitude from a given address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to get a longitude & latitude from a given address" Watch "how to get a longitude & latitude from a given address" New topic
Author

how to get a longitude & latitude from a given address

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
I need to get a longitude & latitude from a given address ?
can any one tell me ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18120
    
    8

There are web services you can contact for this sort of information. The one we use where I work belongs to Google: The Google Geocoding API. The word for what you want to do is "geocoding".
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
That's what the android.location.Geocoder class does.
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
this is my java class


this is my main xml



this is the exception i am getting




}
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
So Android can't find the com.draw.FindLocation class - is it part of the .apk file? It's not part of Android itself.
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
I create a new project

this is my java class



this is main.xml


this is geocodexml file


this is th\e error


Michal Krawczyk
Greenhorn

Joined: Oct 15, 2011
Posts: 3
Here is working code:

SearchByAddress.java


view.xml
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
I try this with your example .then it gives this error.please see attachment.


[Thumbnail for error.jpg]

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Instead of posting attachments, it would help if you copy paste the stack trace


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Michal Krawczyk
Greenhorn

Joined: Oct 15, 2011
Posts: 3
I run my code which I paste above and everything is ok.
Execution result is on the image placed here

Your console says there is a problem with your device. You tried run application once or maybe more?

You can try choose your Android API version 1.6, I know that can help sometimes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get a longitude & latitude from a given address
 
Similar Threads
Having issues reRendering a map when a rich:tree node is clicked on(SOLVED)
How to get "closest to" values in a query?
Given a zip code return latitude and longitude
Help In Creating a Mobile Tracker
Displaying Location map on JFrame