Get Latitude and Longitude from SQLite database for use in Android MapOverlay -


How do I get these values ​​if I store the latitude and longitude of a bunch of locations in the SQLite database And will I move them into an OverlayItem class for use in Google's map code?

Database Name: Database

Table Name: Location Location Table:

  • id
  • title
  • details
  • latitude
  • longitude

    How do I get latitude and longitude data for each location And add it to an Arrayite item overlay?

    Do you have any ideas or an example? Thank you very much

    You want to do a query like this:

     < Code> Choose from title, description, latitude, location   

    This can be done in Android:

      / * databaseObject = yourDbHelper #getReadableDatabase (); * / Arrestist & lt; Overlayem & gt; Item = new arreelist & lt; Overlayem & gt; (); Cursor space casser = database object.query ("location", new string [] {"title", "description", "latitude", "longitude"}, empty, empty, empty, null, blank); LocationCursor.moveToFirst (); Do {String Title = Location Kansas. String (location cursor .getColumnIndex ("title")); String description = locationCursor.String (location cursor .getColumnIndex ("description")); Int latitude = (int) (place cursor gate (location cursor .getColumnIndex ("latitude")) * 1a6); Int longitude = (int) (space cursor gate (location cursor .getColumnIndex ("longitude")) * 1a6); Items.add (new overlayem (new GeoPoint (latitude, longitude), title, description)); } While (locationCursor.moveToNext ());   

    You have to multiply values ​​up to 1E6 because Android uses an integer representation of latitude / long values ​​if you already take care of it, then when you create a database, multiply Skip and locationCursor.getInt (...) .

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -