Run C++ Class via UMG Button

Hi everyone

  1. I’m currently working on an android project and trying to run IAB system. I wanted to know is it possible to run a C++ class by pressing the UMG button , Like when user press the buy button the c++ class runs.

  2. Also wanted to know how can I compile Java and Android codes in visual studio? what type of class I should build for it?
    I tried a java code in a blueprint function library class ( set the solution platform to Android ) and compile failed in both VS and editor.

Thanks in Advance!

Here is what I’m trying to compile: