summaryrefslogtreecommitdiff
path: root/platform/android/src/native_map_view.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/native_map_view.cpp')
-rwxr-xr-xplatform/android/src/native_map_view.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index af1473ca34..e188a98c6e 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -780,10 +780,15 @@ void NativeMapView::addLayer(JNIEnv& env, jlong nativeLayerPtr, jni::String befo
}
/**
- * Remove by layer id. Ownership is not transferred back
+ * Remove by layer id.
*/
-void NativeMapView::removeLayerById(JNIEnv& env, jni::String id) {
- map->removeLayer(jni::Make<std::string>(env, id));
+jni::Object<Layer> NativeMapView::removeLayerById(JNIEnv& env, jni::String id) {
+ std::unique_ptr<mbgl::style::Layer> coreLayer = map->removeLayer(jni::Make<std::string>(env, id));
+ if (coreLayer) {
+ return jni::Object<Layer>(createJavaLayerPeer(env, *map, std::move(coreLayer)));
+ } else {
+ return jni::Object<Layer>();
+ }
}
/**