private void addPages(String packageName, Context context) throws IOException, URISyntaxException, ClassNotFoundException, NameNotFoundException { AnnotationRegistrar registrar = new AnnotationRegistrar(packageName, context); registrar.register( new Registration() { public void install(Annotation annotation, Class<?> toRegister) { if (annotation instanceof CalatravaPage) { String pageName = ((CalatravaPage) annotation).name(); Log.d(TAG, "Registering Calatrava page: " + pageName); pageFactories.put(pageName, toRegister); } } }); }