Concerning the outputting of an Toast, I found that there are some ways to make a Toast, that invoke calling a FindClass on JNIEnv object with the android/widget/Toast parameter, but I found no references in the code doing this.

I found this code here

jclass toast = (*env)->FindClass(env, "android/widget/Toast");
// ToastクラスのmakeTextスタティックメソッドのメソッドIDを取得する
jmethodID methodMakeText = (*env)->GetStaticMethodID(env, toast, "makeText", "(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;");
if(methodMakeText == NULL){
LOGE("toast.makeText not Found");


But when using the strings tool on the C++ compiled files used in the app I'm decompiling, I haven't found any references to a Toast.

What other ways there are to call methods in a Java library, e.g. make a Toast?

  • Does your app have java components?
    – sudhackar
    Dec 30, 2020 at 8:18
  • @sudhackar , yes Dec 30, 2020 at 17:00

1 Answer 1


You can try:

jclass toast = (*env)->FindClass(env, "android/widget/Toast"); // get the class you need (need to be already loaded otherwise you have to define it first)
jmethodID methodToCall = env->GetStaticMethodID(toast, "makeText", "(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;"); // get your desidered method

env->CallStaticVoidMethod(toast, methodToCall, <your parameters here>); // ask the jvm to call your method (assuming its static)
  • I just posted this code in my answer.. Thank you for your contribution though. Helping me explore options beyond this one and its implementations would've helped me more. Jan 22, 2021 at 7:43
  • well i actually dont think there are more options.. atleast i never seen something different to call a method via jni
    – Princekin
    Jan 22, 2021 at 8:09
  • That is the point. The app is displaying the toast in a very obscure manner Jan 22, 2021 at 8:30
  • Maybe reflections via jni?
    – Princekin
    Jan 26, 2021 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.