0

I currently am working on developing an android app. I have an SQLite database set up in the app and Google Maps as well (i.e. its displaying the map when the user wants to see it).

  • My problem is that my SQLite database has 3 columns : Name, cell number and address. My aim is that the entries made by users in the address column be displayed as pinpoints in Google Maps. Eg if someone makes an entry: Richard, 0333 1321421, Berlin Street Hawaii. Then a pinpoint should show up on that particular address in Google Maps. So far i have had no luck in figuring out how to accomplish this.

I would greatly appreciate it if someone could tell me how to:

  1. Convert address entries to longitude, latitude
  2. Display a pinpoint in google maps on that particular latitude, longitude.

Also, is conversion of an address to latitude, longitude necessary or can a pinpoint be made directly over the address with just the address alone.

Any sample codes which demonstrate this would be very helpful. I am currently making this app in Google API 2.2 api level 8 in eclipse java.

Malik
  • 55
  • 1
  • 12

1 Answers1

0

So as you can understand you need to perform 2 steps of work:

  1. convert your text string address into a Latlng cordinates.

  2. present a marker on the map using the LatLng cordinates you found in the first step.

for the first step you could find the code here:

How can I find the latitude and longitude from address?

for the second part it's important to know what version of Google maps API you are using?

UPDATE:

https://github.com/commonsguy/cw-android/blob/master/Maps/NooYawk/src/com/commonsware/android/maps/NooYawk.java

but keep in mind that this version of Google Maps will be deprecated soon.

Community
  • 1
  • 1
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • Sir, I'm using version 1 of Google maps API. – Malik Mar 06 '13 at 00:01
  • According to Google, the old version will still be usable in apps. Only new features and updates will not be added to it. So i don't think it should cause a problem as far as usage of the map in the app is concerned, atleast as far as the emulator is concerned. – Malik Mar 06 '13 at 00:38
  • but what is the reason not to use API V2 that looks much better? – Emil Adz Mar 06 '13 at 00:41
  • Im still a beginner at android. This is my second app and i decided to stick with v1 so if i got stuck somewhere i could refer to tutorials and help material on the web which is mostly for api v1. Unfortunately, there's little material on how SQLite and Google maps interact. Which is why im trying to find out how i would now acquire the lat, long coords from SQLite and place a marker on them in google maps? – Malik Mar 06 '13 at 00:53
  • I gave you the code for doing both you just have to combine it together. – Emil Adz Mar 06 '13 at 00:57