jclass envClz = (*env)->FindClass(env, "android/os/Environment");
jmethodID getExternalStorageDirectory = (*env)->GetStaticMethodID(env, envClz,
"getExternalStorageDirectory",
"()Ljava/io/File;");
jobject jobject1 = (*env)->CallStaticObjectMethod(env, envClz, getExternalStorageDirectory);
jmethodID getAbsolutePath = (*env)->GetMethodID(env, (*env)->FindClass(env, "java/io/File"),
"getAbsolutePath",
"()Ljava/lang/String;");
jstring jstring1 = (*env)->CallObjectMethod(env, jobject1, getAbsolutePath);
const char *path_utf = (*env)->GetStringUTFChars(env, jstring1, NULL);
LOGE("%s", path_utf);
(*env)->ReleaseStringUTFChars(env, jstring1, path_utf);
安卓开发,在jni环境中获取手机外储存路径
最新推荐文章于 2021-05-27 07:00:16 发布