开发者

Adapter from C++ output stream to an Android TextView or equivalent?

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜