mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
aux/android/load_class: Use pkgClassLoader.loadClass to load MonadoView class.
This commit is contained in:
parent
dbe0338956
commit
2a8db3d780
|
@ -27,6 +27,7 @@ getAppInfo(std::string const &packageName, jobject application_context)
|
|||
PackageManager::GET_SHARED_LIBRARY_FILES);
|
||||
return packageInfo.getApplicationInfo();
|
||||
} catch (std::exception const &e) {
|
||||
U_LOG_E("Could get App Info: %s", e.what());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +48,20 @@ loadClassFromPackage(ApplicationInfo applicationInfo,
|
|||
wrap::java::lang::ClassLoader pkgClassLoader =
|
||||
pkgContext.getClassLoader();
|
||||
|
||||
auto loadedClass = wrap::java::lang::Class::forName(
|
||||
clazz_name, true, pkgClassLoader.object());
|
||||
return loadedClass;
|
||||
try {
|
||||
auto loadedClass =
|
||||
pkgClassLoader.loadClass(std::string(clazz_name));
|
||||
if (loadedClass.isNull()) {
|
||||
U_LOG_E("Could not load class for name %s", clazz_name);
|
||||
return wrap::java::lang::Class();
|
||||
}
|
||||
|
||||
return loadedClass;
|
||||
} catch (std::exception const &e) {
|
||||
U_LOG_E("Could load class '%s' forName: %s", clazz_name,
|
||||
e.what());
|
||||
return wrap::java::lang::Class();
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
|
|
Loading…
Reference in a new issue