In my NDK Android app, Java part runs native C code to perform intensive calculations. It does so by creating an AsyncTask worker object that runs the native code in a separate thread via the JNI. The Java GUI has a stop button and the native code has a variable which is used as a stop flag to abort a lengthy calculation.In my NDK Android app, Java part runs native C