lundi 8 juin 2015

Reading LatLng from SQLite Database for Google Map Markers

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

Aucun commentaire:

Enregistrer un commentaire