-1

I am trying to fill areas of Seattle with pindrops that will provide information when pressed, but am trying to avoid hard coding each and every pindrop. I think it would be easiest to fill a database (SQLite) with the information and have a method that automatically converts the information into the pindrops, but I'd like to confirm this.

This is a super vague question, and I am just looking for someone to point me in a good direction as I have hit a wall. How should I be going about this? Would SQLite be the simplest solution? Is there an easier way? Thanks!!

klyan
  • 5
  • 1
  • 2

3 Answers3

1

Under 50 rep so I cannot comment, hence this here.

You can create pin drop points in html. Any database should work. Just grab all points as an array or json and combine it with the appropriate html in a loop function.

//Edit// I just noticed you tagged android. Scratch the html comment and check this out https://developers.google.com/maps/documentation/android/marker

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Jptalon
  • 99
  • 2
  • 10
1

I think a SQLite database wrapped with a ContentProvider would be your best bet. If the coordinates you (will) have are lat lon, it will be cake to just convert them into markers on a map. Also depends what map you're planning of using.

For Google Maps API it would be as simple as:

// When CursorLoader finishes it calls onLoadFinished, there loop the returned data
// Table columns: float latitude, float longitude, String marker title
if (cursor.moveToFirst()) {
    for (int i=0; i<cursor.getCount(); i++ ) {
        mMap.addMarker(new MarkerOptions()
                .position(new LatLng(cursor.getFloat(0), cursor.getFloat(1)))
                .title(cursor.getString(2))
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)));
    }
}
Simas
  • 43,548
  • 10
  • 88
  • 116
  • I did some research on ContentProviders and I'm still confused on their purposes and benefits. Is the ContentProvider necessary if I am only trying to make one app? Does it just make the database more flexible? – klyan Aug 09 '14 at 00:56
0

Yes using sqlite would be a totally better choice than hardcoding it into the app. You can then use PHP to read data from the sqlite database and display it on the page using google maps api or whatever you like.

someguy234
  • 559
  • 4
  • 17