Closed clj0020 closed 5 years ago
Hi @clj0020 , please see https://github.com/mapbox/mapbox-navigation-android/blob/master/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java#L82. This static method needs to be called before loading instructions like this: ImageCreator.getInstance().initialize(getContext());
.
Please reopen. I am using the InstructionLoader according to docs here I shouldn't need to create an instance of ImageCreator. This is an issue with InstructionLoader.
@clj0020 it looks like the docs don't mention that, I'll get those updated. You can see an example use of this in the InstructionView
: https://github.com/mapbox/mapbox-navigation-android/blob/master/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java#L144 . The problem that the InstructionLoader
loads highway shields by default, and if you haven't called ImageCreator.initialize
, Picasso
won't be loaded to show the highway signs, so this is a required part of the workflow. If you'd like to be able to use the InstructionLoader
without loading highway signs, you can open a feature request for that. But currently, before InstructionLoader.loadInstruction
is called, ImageCreator.initialize(context)
must be called once (the shield images are pre-fetched). Please let me know if that clarifies the situation.
@devotaaabel Thank you that helped a lot. It was the docs that were confusing me. Maybe InstructionLoader should initialize ImageCreator in it's constructor so that it requires less lines to use.
Android API: Navigation Mapbox Navigation SDK version: 0.33.1
Steps to trigger behavior
Expected behavior
TextView updated with step instruction.
Actual behavior
Crash when ImageCreator calls hasImages and also when ImageCreator calls addShieldInfo().
Code
Stacktrace
When no Shields are present.
When Shields are present.