Ho tale codice:google maps android aggiungono al marcatore proprio tag
protected void onPostExecute(final ArrayList<HashMap<String, String>> adapter) {
for (final HashMap<String, String> a : adapter) {
LatLng pos = new LatLng(Double.valueOf(a.get(TAG_latitude)), Double.valueOf(a.get(TAG_longitude)));
Log.e("pppppos", String.valueOf(pos.latitude));
Marker m = map.addMarker(new MarkerOptions().position(pos)
.title(a.get(TAG_NAME))
.snippet("Kiel is cool"));
map.setOnInfoWindowClickListener(
new OnInfoWindowClickListener(){
public void onInfoWindowClick(Marker marker){
Intent nextScreen = new Intent(SearchExchangerActivity.this, BankExchangersListActivity.class);
nextScreen.putExtra("exchanger_id", id);
startActivityForResult(nextScreen, 0);
}
});
}
ma ho bisogno di impostare invisibile a campo utente, ad esempio Tag_id
per ogni indicatore, e utilizzare questo ID poi, quando l'invio di informazioni in più per altri attività, qualcosa di simile a:
protected void onPostExecute(final ArrayList<HashMap<String, String>> adapter) {
for (final HashMap<String, String> a : adapter) {
LatLng pos = new LatLng(Double.valueOf(a.get(TAG_latitude)), Double.valueOf(a.get(TAG_longitude)));
Marker m = map.addMarker(new MarkerOptions().position(pos)
.title(a.get(TAG_NAME))
.snippet("Kiel is cool")
.Tag_id(TAG_ID));
map.setOnInfoWindowClickListener(
new OnInfoWindowClickListener(){
public void onInfoWindowClick(Marker marker){
Intent nextScreen = new Intent(SearchExchangerActivity.this, BankExchangersListActivity.class);
nextScreen.putExtra("exchanger_id", marker.get(TAG_ID));
startActivityForResult(nextScreen, 0);
}
});
}
è reale di fare? Come posso vedere nel mio listener quale marker sto facendo clic?
Inoltre potrebbe essere fatto tramite campo del titolo ... Ma sto ottenendo l'errore di quando si scrive marker.getTitle()
...
upd
for (final HashMap<String, String> a : adapter) {
LatLng pos = new LatLng(Double.valueOf(a.get(TAG_latitude)), Double.valueOf(a.get(TAG_longitude)));
Log.e("pppppos", String.valueOf(pos.latitude));
HashMap<Marker, String> m = new HashMap<Marker, String>();
m.put(map.addMarker(new MarkerOptions().position(pos)
.title(a.get(TAG_NAME))
.snippet("Kiel is cool")), "1");
}
map.setOnInfoWindowClickListener(
new OnInfoWindowClickListener(){
public void onInfoWindowClick(HashMap<Marker, String> marker){
Intent nextScreen = new Intent(SearchExchangerActivity.this, BankExchangersListActivity.class);
nextScreen.putExtra("exchanger_id", "1");
startActivityForResult(nextScreen, 0);
}
});
si potrebbe dare esempio di utilizzo Mappa? –
quando provo a scrivere Mappa m = m.put (map.addMarker (nuovi MarkerOptions(). Posizione (pos) \t \t \t \t .title (a.get (TAG_NAME)) \t \t \t \t \t \t \t .snippet ("Kiel is cool")), "1"); \t qualcosa è male –
@ValdisAzamaris Vedi qui per soluzioni alternative usando 'Map': http://code.google.com/p/gmaps-api-issues/issues/detail?id=4650 –