This is my situation: I have an Activity which reads the current Location, shows the Address in a TextView and sets a Marker on a "small" GoogleMap" at the bottom area of the Activity. At this map ScrollGestures are disabled - it's just to show the current location to the user.
IF the currect Location is not correct the User should be able to click somewhere on the map, which opens a new activity where he can drag the marker to his correct position.
My question is: How can i start a new Activity by clicking somewhere on the map.
I tried this, but i was not able to put an Intent in the onClick method: a link!
Here is my code:
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
//googleMap.setMyLocationEnabled(true);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(
lat, lng), 13));
googleMap.getUiSettings().setScrollGesturesEnabled(false);
googleMap.setOnMapClickListener(new OnMapClickListener() {
@Override
public void onMapClick(LatLng arg0) {
Intent intent2 = new Intent(this, SettingsActivity.class);
startActivity(intent2);
}
});
addMarker();
}
}
}