Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First you need to get all your database values to a list: example a store list with latitude and longitude. Then you have to add each and every marker to the map in this way (below code handles the click also):</p> <pre><code>private final void addLocationsToMap() { int i = 0; for (Stores store : storeList) { LatLng l = new LatLng(store.getLatitude(), store.getLongtitude()); MarkerOptions marker = new MarkerOptions() .position(l) .title(store.getStoreName()) .snippet("" + i) .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); googleMap.addMarker(marker); ++i; } googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() { @Override public void onInfoWindowClick(Marker marker) { try { popUpWindow.setVisibility(View.VISIBLE); Stores store = storeList.get(Integer.parseInt(marker .getSnippet())); // set details email.setText(store.getEmail()); phoneNo.setText(store.getPhone()); address.setText(store.getAddress()); // setting test value to phone number tempString = store.getPhone(); SpannableString spanString = new SpannableString(tempString); spanString.setSpan(new UnderlineSpan(), 0, spanString.length(), 0); phoneNo.setText(spanString); // setting test value to email tempStringemail = store.getEmail(); SpannableString spanString1 = new SpannableString(tempStringemail); spanString1.setSpan(new UnderlineSpan(), 0, spanString1.length(), 0); email.setText(spanString1); storeLat = store.getLatitude(); storelng = store.getLongtitude(); } catch (ArrayIndexOutOfBoundsException e) { Log.e("ArrayIndexOutOfBoundsException", " Occured"); } } }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload