--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
Hi Maidul,
You can achieve this from your C++ code by using JNI to talk back to the Java app framework.
In our case, we subclass NativeActivity and invoke it as follows:
Java Code:
package com.yourcompany.yourapp;
...
class Keyboard
{
static void Show()
{
InputMethodManager m = (InputMethodManager)NativeActivitySubclass.Get().getSystemService(Context.INPUT_METHOD_SERVICE);
m.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
static void Hide()
{
InputMethodManager m = (InputMethodManager)NativeActivitySubclass.Get().getSystemService(Context.INPUT_METHOD_SERVICE);
m.toggleSoftInput(0, 0);
}
}
C++ Code:
JNIEnv* env = System::GetJNI(); //gets a JNI for this thread
jclass keyboard = Util::Java::LoadClass( "com.yourcompany.yourapp.Keyboard"); //uses class loader internally since this thread does not have direct access to this user defined class
jmethodID show = env->GetStaticMethodID( keyboard, "Hide", "()V");
env->CallStaticVoidMethod( keyboard, show );
Best,
Stephane Jacoby
Hello step_jac,
I am new on JNI and NDK.
according to your code, when I am running I got compilation error.
Could you please send me a whole source code to my email mmaidu...@gmail.com
Best Regards,
Maidul
On Wednesda August 1, 2012 9:19:00 AM UTC+5:30, Maidul Islam wrote:Hello Stephane Jacoby,
Thank you very much for your help.
Best Regards,
Maidul