return set_flag;
}
+ /**
+ * Check that the class can operate (for instance, that all the required
+ * libraries or frameworks are present).
+ *
+ * @return TRUE if it works
+ */
+ abstract protected boolean check();
+
/**
* Create a new {@link ImageUtils}.
*
for (String clazz : new String[] { "be.nikiroo.utils.ui.ImageUtilsAwt",
"be.nikiroo.utils.android.ImageUtilsAndroid" }) {
try {
- return (ImageUtils) SerialUtils.createObject(clazz);
- } catch (Exception e) {
+ ImageUtils obj = (ImageUtils) SerialUtils.createObject(clazz);
+ if (obj.check()) {
+ return obj;
+ }
+ } catch (Throwable e) {
}
}