[android] example custom layer - add context lost callback
This commit is contained in:
committed by
Ivo van Dongen
parent
d1e69c8baf
commit
779fc8aeee
@@ -92,6 +92,10 @@ void nativeRender(void *context, const mbgl::style::CustomLayerRenderParameters&
|
||||
reinterpret_cast<ExampleCustomLayer*>(context)->render();
|
||||
}
|
||||
|
||||
void nativeContextLost(void */*context*/) {
|
||||
mbgl::Log::Info(mbgl::Event::General, "nativeContextLost");
|
||||
}
|
||||
|
||||
void nativeDenitialize(void *context) {
|
||||
mbgl::Log::Info(mbgl::Event::General, "nativeDeinitialize");
|
||||
delete reinterpret_cast<ExampleCustomLayer*>(context);
|
||||
@@ -122,6 +126,10 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
||||
env->GetStaticFieldID(customLayerClass, "RenderFunction", "J"),
|
||||
reinterpret_cast<jlong>(nativeRender));
|
||||
|
||||
env->SetStaticLongField(customLayerClass,
|
||||
env->GetStaticFieldID(customLayerClass, "ContextLostFunction", "J"),
|
||||
reinterpret_cast<jlong>(nativeContextLost));
|
||||
|
||||
env->SetStaticLongField(customLayerClass,
|
||||
env->GetStaticFieldID(customLayerClass, "DeinitializeFunction", "J"),
|
||||
reinterpret_cast<jlong>(nativeDenitialize));
|
||||
|
||||
Reference in New Issue
Block a user