title: Is it possible to create UI elements with the NDK ? - lack of specs in Android docs
body: <p>After reading the related docs I don't get if I can create things like buttons or other UI elements used to get user inputs with just the use of C++/C code compiled with the NDK.</p>
  
  <p>There are no problems when i want to handle a "window" or activity that needs to stay in focus, but I don't get how to build an UI with elements for callbacks and user input.</p>
  
  <p>It's strange that there is a windowing framework in place but without any trace of callbacks for UI elements.</p>
  
  <p>Can I build touch buttons or a virtual gamepad with the NDK ?</p>
  
  <hr>
  
  <p>I appreciate the effort and the fact that we are getting closer to my point but apparently i wasn't explaining myself good enough.</p>
  
  <p>I found this image <a href="https://stackoverflow.com/questions/12687575/touch-buttons-and-controllers-with-the-ndk-and-native-activities-only-c-c">here</a>
  <img src="https://i.stack.imgur.com/P7fNj.png" alt="enter image description here"></p>
  
  <p>Now my problem and the focus of this question is:</p>
  
  <p>Supposing that i can place and draw this virtual joystick, how i can detect only the movements and have a callback like <code>Joystick.onUp</code> or <code>Joystick.onDown</code> with Android and using only the NDK ?</p>
  
  <p>If there are no callbacks of this kind available from the NDK, I'm supposed to detect the [x,y] position everytime, compare it to the location of my joystick, store the previous position, compare the previous position and the next one to get the direction ?</p>
  
  <p>Since the sensor throws events at a really fast rate, i think that building this on my own considering only the raw X,Y couple, will end up in having a really inefficient control system because it will not be optimized at OS level with the appropriate sensor calls.</p>
  
  <p>According to the NativeActivity example it's also unclear how to handle multiple touch point, for example how i can handle 2 touch event at the same time ?</p>
  
  <p>Just consider the image above and think about having only x,y coordinate for 1 touch point and how i can solve this in an efficient way that is supported by the NDK.</p>
  
  <p>Thanks.</p>