Hashmap Not Returning Image To Marker By Onmarkerclick
I have a marker created by camera intent and then returned to the map as a thumbnail. Now what i want to do is to tap on the marker to display the full image for each marker that
Solution 1:
If you want to do like this:
Uri imgUri = Uri.parse("file://" + markerImagePathMap.get(marker.getId())
you need to do like this:
markerImagePathMap.put(marker.getId(), destinationFile);
So the code should be like this:
private Map<String, File> markerImagePathMap;
protectedvoidonCreate(Bundle savedInstanceState) {
...
markerImagePathMap = newHashMap<String, File>();
...
}
protectedvoidonActivityResult(int requestCode, int resultCode, Intent data) {
...
//destinationFile = new File(sdCard, imageStorageFolder1 + filename + fileNameExtension); // <--- DeleteFiledestinationFile=newFile(sdCard, imageStorageFolder1 + filename + fileNameExtension); // <--- Add
...
Markermarker= googleMap.addMarker(markerOptions);
Log.d(TAG, marker.getId() + " -> " + destinationFile.getAbsolutePath()); // <--- Add
markerImagePathMap.put(marker.getId(), destinationFile);
...
}
publicbooleanonMarkerClick(Marker marker){
...
//markerImagePathMap.put(destinationFile, marker.getId()); <-- what is this for?FiledestinationFile= markerImagePathMap.get(marker.getId())
UriimgUri= Uri.parse("file://" + destinationFile.getAbsolutePath());
...
}
Post a Comment for "Hashmap Not Returning Image To Marker By Onmarkerclick"