Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
2693:0dac724f890f | 2694:cee79add3669 |
---|---|
7230 * Returns: | 7230 * Returns: |
7231 * DW_ERROR_UNKNOWN (-1) on error; DW_ERROR_NONE (0) or a positive Process ID on success. | 7231 * DW_ERROR_UNKNOWN (-1) on error; DW_ERROR_NONE (0) or a positive Process ID on success. |
7232 */ | 7232 */ |
7233 int API dw_browse(const char *url) | 7233 int API dw_browse(const char *url) |
7234 { | 7234 { |
7235 return DW_ERROR_UNKNOWN; | 7235 JNIEnv *env; |
7236 int retval = DW_ERROR_UNKNOWN; | |
7237 | |
7238 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
7239 { | |
7240 // Construct a string | |
7241 jstring jstr = env->NewStringUTF(url); | |
7242 // First get the class that contains the method you need to call | |
7243 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
7244 // Get the method that you want to call | |
7245 jmethodID browseURL = env->GetMethodID(clazz, "browseURL", | |
7246 "(Ljava/lang/String;)I"); | |
7247 // Call the method on the object | |
7248 retval = env->CallIntMethod(_dw_obj, browseURL, jstr); | |
7249 if(_dw_jni_check_exception(env)) | |
7250 retval = DW_ERROR_UNKNOWN; | |
7251 } | |
7252 return retval; | |
7236 } | 7253 } |
7237 | 7254 |
7238 /* | 7255 /* |
7239 * Creates a new print object. | 7256 * Creates a new print object. |
7240 * Parameters: | 7257 * Parameters: |