Porting a C++ app to Android JNI... would like to route C++ cout and cerr to an Android TextView or similar display for testing purposes. Is there an open source JNI adapter that does this already? If not, I would like some hints on how to write such an adapter in a quick & dirty fashion. T开发者_开发问答hanks for helping this Android n00b.
For testing purposes, use Android's native logging facility.
#include <android/log.h>
__android_log_write(ANDROID_LOG_ERROR, "MyProject", "Hello world");
__android_log_print(ANDROID_LOG_ERROR, "MyProject", "The value is %d", value);
In the Android.mk, add liblog to the link source list:
LOCAL_LDLIBS := -llog
精彩评论