how to save a c++ object in java object and use it
2012-08-12 10:58
645 查看
http://blog.csdn.net/luoshengyang/article/details/6817933
save:
static void android_os_MessageQueue_setNativeMessageQueue(JNIEnv* env, jobject messageQueueObj,
NativeMessageQueue* nativeMessageQueue) {
env->SetIntField(messageQueueObj, gMessageQueueClassInfo.mPtr,
reinterpret_cast<jint>(nativeMessageQueue));
}
reuse:
nativePollOnce(mPtr, nextPollTimeoutMillis);
static void android_os_MessageQueue_nativePollOnce(JNIEnv* env, jobject obj,
jint ptr, jint timeoutMillis) {
NativeMessageQueue* nativeMessageQueue = reinterpret_cast<NativeMessageQueue*>(ptr);
nativeMessageQueue->pollOnce(timeoutMillis);
}
save:
static void android_os_MessageQueue_setNativeMessageQueue(JNIEnv* env, jobject messageQueueObj,
NativeMessageQueue* nativeMessageQueue) {
env->SetIntField(messageQueueObj, gMessageQueueClassInfo.mPtr,
reinterpret_cast<jint>(nativeMessageQueue));
}
reuse:
nativePollOnce(mPtr, nextPollTimeoutMillis);
static void android_os_MessageQueue_nativePollOnce(JNIEnv* env, jobject obj,
jint ptr, jint timeoutMillis) {
NativeMessageQueue* nativeMessageQueue = reinterpret_cast<NativeMessageQueue*>(ptr);
nativeMessageQueue->pollOnce(timeoutMillis);
}
相关文章推荐
- How to use the System Restore API to save and to restore system data in Visual C++
- (Page 1 of 3 )A walking tour of JavaBeans What JavaBeans is, how it works, and why you want to use it
- (zhuan) Attention in Neural Networks and How to Use It
- (Page 2 of 3 )A walking tour of JavaBeans 2 :What JavaBeans is, how it works, and why you want to use it
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- (Page 3 of 3 )A walking tour of JavaBeans What JavaBeans is, how it works, and why you want to use it
- How to create a DLL library in C and then use it with C#
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- How to build & install GLFW 3 and use it in a Linux project
- How to use Comparator and Comparable in Java? With example
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- make it clear how to use const in C++
- How to use ConcurrentHashMap in Java - Example Tutorial and Working
- how to make Completion Handlers and use it in Swift
- What is reflection and how to use it in CSharp ?
- How to create Immutable Class and Object in Java - Tutorial Example
- c++ - How to use wstring and wcout to output Chinese words in Xcode? - Stack Overflow
- How to create a DLL library in C and then use it with C#
- How to use equals( ) and equalsIgnoreCase( ) in Java
- How to get a type in C++ when its template argument is the argument