MCPcopy Create free account
hub / github.com/SatDump/SatDump / ShowSoftKeyboardInput

Function ShowSoftKeyboardInput

android/main.cpp:310–338  ·  view source on GitHub ↗

Unfortunately, there is no way to show the on-screen input from native code. Therefore, we call ShowSoftKeyboardInput() of the main activity implemented in MainActivity.kt via JNI.

Source from the content-addressed store, hash-verified

308// Unfortunately, there is no way to show the on-screen input from native code.
309// Therefore, we call ShowSoftKeyboardInput() of the main activity implemented in MainActivity.kt via JNI.
310static int ShowSoftKeyboardInput()
311{
312 JavaVM *java_vm = g_App->activity->vm;
313 JNIEnv *java_env = NULL;
314
315 jint jni_return = java_vm->GetEnv((void **)&java_env, JNI_VERSION_1_6);
316 if (jni_return == JNI_ERR)
317 return -1;
318
319 jni_return = java_vm->AttachCurrentThread(&java_env, NULL);
320 if (jni_return != JNI_OK)
321 return -2;
322
323 jclass native_activity_clazz = java_env->GetObjectClass(g_App->activity->clazz);
324 if (native_activity_clazz == NULL)
325 return -3;
326
327 jmethodID method_id = java_env->GetMethodID(native_activity_clazz, "showSoftInput", "()V");
328 if (method_id == NULL)
329 return -4;
330
331 java_env->CallVoidMethod(g_App->activity->clazz, method_id);
332
333 jni_return = java_vm->DetachCurrentThread();
334 if (jni_return != JNI_OK)
335 return -5;
336
337 return 0;
338}
339
340static int HideSoftKeyboardInput()
341{

Callers 1

tickFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected