Guest User

Untitled

a guest
Aug 15th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. bool UUnrealNativeFunctionsBlueprintLibrary::ShowToast()
  2. {
  3. UE_LOG(LogTemp, Warning, TEXT("Log message from UUnrealNativeFunctionsBlueprintLibrary::ShowToast()"));
  4.  
  5. #if PLATFORM_ANDROID && USE_ANDROID_JNI
  6. bool bIsOptional = false;
  7.  
  8. JNIEnv* Env = FAndroidApplication::GetJavaEnv();
  9.  
  10. jclass windowUtilsClass = FAndroidApplication::FindJavaClass("PACKAGE NAME");
  11. jmethodID showToastMethod = FJavaWrapper::FindStaticMethod(Env, windowUtilsClass, "showToast", "(Landroid/app/Activity;Ljava/lang/String;)V", bIsOptional);
  12.  
  13. FString strToast = "Toast message";
  14. jstring toastMessage = Env->NewStringUTF(TCHAR_TO_UTF8(*strToast));
  15.  
  16. Env->CallStaticVoidMethod(windowUtilsClass, showToastMethod, FJavaWrapper::GameActivityThis, toastMessage);
  17.  
  18. Env->DeleteLocalRef(toastMessage);
  19. #endif
  20.  
  21. return true;
  22. }
Add Comment
Please, Sign In to add comment