daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Aug 15th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top