Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display speed limit on navigation map? #90

Open
krunal-sisnolabs opened this issue May 30, 2022 · 1 comment
Open

How to display speed limit on navigation map? #90

krunal-sisnolabs opened this issue May 30, 2022 · 1 comment

Comments

@krunal-sisnolabs
Copy link

krunal-sisnolabs commented May 30, 2022

I want to add speed limit in my app.
I refer these
https://docs.mapbox.com/android/navigation/guides/ui-components/speed-limit/
https://docs.mapbox.com/android/navigation/examples/show-speed-limit/

but it give me error this error "Type mismatch: inferred type is MapboxNavigationView but Context was expected" for below code.

// Define speed limit formatter options
private val speedLimitFormatter: SpeedLimitFormatter by lazy {
SpeedLimitFormatter(this)
}

for SpeedLimitFormatter variable

Can you please help me how to add speed limit code in MapboxNavigationView.kt file.

@krunal-sisnolabs
Copy link
Author

Hi,
I solved it myself.
replace "this" with "context"

Code :
// Define speed limit formatter options
private val speedLimitFormatter: SpeedLimitFormatter by lazy {
SpeedLimitFormatter(context)
}

Now speed limit is worked on my navigation map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant