Google Maps Android API v2 détecter long clic sur la carte et ajouter un marqueur ne fonctionne pas

Je veux ajouter un marqueur sur la carte avec un clic long. mais ça ne fonctionne pas. normal clic de travail. Toast dans onMapClick() est affiché avec robinet normale. mais à long cliquez sur ne fonctionne pas. Toast dans onMapLongClick() n'est pas affichée avec le clic long. également marqueur n'est pas affiché sur la carte.

Je suis en utilisant SupportMapFragment parce que je veux utiliser mon application sur android 2.x appareils. J'ai testé de mon application sur le nexus one qui a la version android 2.3.7.

C'est mon code.

public class MainActivity extends FragmentActivity implements
OnMapClickListener, OnMapLongClickListener {
final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;
Location myLocation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager
.findFragmentById(R.id.map);
myMap = mySupportMapFragment.getMap();
myMap.setMyLocationEnabled(true);
myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
//myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//myMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
//myMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
myMap.setOnMapClickListener(this);
myMap.setOnMapLongClickListener(this);
}
@Override
protected void onResume() {
super.onResume();
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());
if (resultCode == ConnectionResult.SUCCESS) {
Toast.makeText(getApplicationContext(),
"isGooglePlayServicesAvailable SUCCESS", Toast.LENGTH_LONG)
.show();
} else {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
RQS_GooglePlayServices);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public void onMapClick(LatLng point) {
myMap.animateCamera(CameraUpdateFactory.newLatLng(point));
Toast.makeText(getApplicationContext(), point.toString(),
Toast.LENGTH_LONG).show();
}
@Override
public void onMapLongClick(LatLng point) {
myMap.addMarker(new MarkerOptions().position(point).title(
point.toString()));
Toast.makeText(getApplicationContext(),
"New marker added@" + point.toString(), Toast.LENGTH_LONG)
.show();
}
}

Comment puis-je résoudre ce problème ?

source d'informationauteur Bishan