I'm trying to display an image, the path of which is stored in a database.
I'm iterating over all locations, and for each I display a marker. There is, however some problem with loading photo by path (line marked).
private void loadLocations() {
dataSource.open();
ArrayList <LocationEntry> locations = dataSource.getLocationsFromTrack(trackId);
dataSource.close();
for(int i=0; i<locations.size(); i++)
{
map.addMarker(new MarkerOptions()
.position(locations.get(i).getCoordinates())
.title(locations.get(i).getName())
.snippet(locations.get(i).getSnippet())
.icon(BitmapDescriptorFactory.fromPath(locations.get(i).getPhotoURL()))); //here
}
}
The photo URL that is handed over to fromPath function looks like this:
'/mnt/sdcard/camtest/26'
I checked this location, and I'm sure that the file of that name exists there. So BitmapDescriptorFactory has problems processing the file path, as it returns null. Any ideas how to solve this? Any alternate ways to get image by its path?