Note that there are some explanatory texts on larger screens.

plurals
  1. POcomparisons using a hashMap not giving expected result
    primarykey
    data
    text
    <p>The problem at hand is that when i try to pull the value from the <code>hashmap</code> it is returning null.</p> <p>I have a <code>hashMap</code> instance :</p> <p><code>Map&lt;Marker,Tag&gt; theHashMap = new HashMap&lt;Marker,Tag&gt;();</code></p> <p>where tag is a class that holds some simple information about the <code>marker</code> and the <code>marker</code> is a Google map <code>marker</code>. </p> <p>I add to theHashMap at the start of the activity that this all happens in</p> <pre><code>theHashMap.put(mapController.AddMarker(new Tag(1, "City Of Dundee", DUNDEE_LOCATION, "untagged",), new Tag(1, "City Of Dundee", DUNDEE_LOCATION, "untagged",)); </code></pre> <p>where <code>mapController</code> is a class that deals with everything <code>googleMap</code> related.</p> <p>And <code>mapController</code>.<code>AddMarker</code> returns the <code>marker</code> that was added to the map.</p> <p>after the <code>hashMap</code> is filled it is passed to the <code>onMarkerClickListener</code> for later reference.</p> <p>I call <code>hashMap.get(marker);</code> from within a <code>marker listener</code> where <code>marker</code> is the <code>marker</code> that was clicked.</p> <p>It always returns null, I thought it may be because the <code>hashMap</code> inside the onMarkerClick listener was a separate instance but I tried making a pointer to the original and it didn't work, i also tried <code>hashMap.get(marker.getTitle());</code> and with the <code>marker.getID()</code> thinking that it would compare there titles but it ended with the same result.</p> <p>I'll add more information if requested but for now, is there any other way of taking the value from the hashMap based on the marker that was clicked?</p>
    singulars
    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.
 

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