0

I had a problem on how to enter the latitude and longitude of my database SQLiteDatabaseAssets, this code I get from google sites and i don't know how the code to changes the LatLng(-7.963535, 112.640756) with String which ordered by name of the lat and long

public class MainActivity extends Activity implements OnMapReadyCallback {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    MapFragment mapFragment = (MapFragment) getFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap map) {
    LatLng malang = new LatLng(-7.963535, 112.640756);
    ==>> // LatLng malang = new LatLng("it must be get from my database ordered by name");

    map.setMyLocationEnabled(true);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(malang, 13));

    map.addMarker(new MarkerOptions()
            .title("it must be get from my database")
            .position(malang));
    map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
    map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
    map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}}

can anyone help me please? i was tired to find the code :-(

i was already prepared the database in /assets/mydatabase

Nuhun
  • 1
  • 2
  • You could have a table in your database that has name, latitude, and longitude columns. Then query for the location with the name you want and get the latitude and longitude from the element that is returned. – JoeBruzek Jun 08 '15 at 15:23
  • how does your database look like? what columns and what values? Once you know how they look like then perform a select on them (SELECT LONG, LAT FROM YOUR_TABLE), store them in a String[] and use the result for markers. Look at [**this**](http://stackoverflow.com/questions/10600670/sqlitedatabase-query-method) – so_jin_ee Jun 08 '15 at 16:08

0 Answers0