comparison android/dw.cpp @ 2774:94af460bb954

Android: Implement dw_tree_new() and verify code doesn't crash.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 24 May 2022 09:42:35 +0000
parents e256bd8628ba
children 5f77f52df8ac
comparison
equal deleted inserted replaced
2773:f207b7ee177f 2774:94af460bb954
3282 * Returns: 3282 * Returns:
3283 * A handle to a tree window or nullptr on failure. 3283 * A handle to a tree window or nullptr on failure.
3284 */ 3284 */
3285 HWND API dw_tree_new(ULONG cid) 3285 HWND API dw_tree_new(ULONG cid)
3286 { 3286 {
3287 /* TODO: Implement the tree if possible. */ 3287 JNIEnv *env;
3288
3289 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
3290 {
3291 // First get the class that contains the method you need to call
3292 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
3293 // Get the method that you want to call
3294 jmethodID treeNew = env->GetMethodID(clazz, "treeNew",
3295 "(I)Landroidx/recyclerview/widget/RecyclerView;");
3296 // Call the method on the object
3297 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, treeNew, (int)cid), _DW_REFERENCE_WEAK);
3298 return result;
3299 }
3288 return nullptr; 3300 return nullptr;
3289 } 3301 }
3290 3302
3291 /* 3303 /*
3292 * Inserts an item into a tree window (widget) after another item. 3304 * Inserts an item into a tree window (widget) after another item.