3

I read this post on how calling native c-code through JNI in Android applications. I have tested the code and works fine! This program makes a JNI call and prints a string that comes from a C function. Is possible to show the console output of a C function (e.g. the results of printf etc.) in an Android app with the same way?

http://integratingstuff.com/2010/12/12/calling-native-c-code-through-jni-in-android-applications/

Thanasis Petsas
  • 4,378
  • 5
  • 31
  • 57

1 Answers1

9

Instead of printf to console you print to logcat using the function __android_log_write(...). More details about how to set this up here: What is the Log API to call from an Android JNI program?

Community
  • 1
  • 1
Ryan Reeves
  • 10,209
  • 3
  • 42
  • 26