Mercurial > dwindows
diff android/dw.cpp @ 2694:cee79add3669
Andrdoid: Implement dw_browse() to load a URL in a new Activity.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 02 Nov 2021 19:04:56 +0000 |
parents | 7127de139acf |
children | 11aaf443d64b |
line wrap: on
line diff
--- a/android/dw.cpp Mon Nov 01 01:32:42 2021 +0000 +++ b/android/dw.cpp Tue Nov 02 19:04:56 2021 +0000 @@ -7232,7 +7232,24 @@ */ int API dw_browse(const char *url) { - return DW_ERROR_UNKNOWN; + JNIEnv *env; + int retval = DW_ERROR_UNKNOWN; + + if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + { + // Construct a string + jstring jstr = env->NewStringUTF(url); + // First get the class that contains the method you need to call + jclass clazz = _dw_find_class(env, DW_CLASS_NAME); + // Get the method that you want to call + jmethodID browseURL = env->GetMethodID(clazz, "browseURL", + "(Ljava/lang/String;)I"); + // Call the method on the object + retval = env->CallIntMethod(_dw_obj, browseURL, jstr); + if(_dw_jni_check_exception(env)) + retval = DW_ERROR_UNKNOWN; + } + return retval; } /*