ActivityImpl instance = null;
try {
instance = (ActivityImpl) Class.forName(activityClassName).newInstance();
} catch (java.lang.InstantiationException e) {
throw new InstantiationException("Could not instantiate an activity implementation " + activityClassName + " for interface " + activityInterface, e);
} catch (IllegalAccessException e) {
throw new InstantiationException("Could not instantiate an activity implementation " + activityClassName + " for interface " + activityInterface, e);
} catch (ClassNotFoundException e) {
throw new InstantiationException("The implementation class " + activityClassName + " for the interface " + activityInterface + " could not be found", e);
} catch (ClassCastException e) {
throw new InstantiationException("The instance returned from the interface " + activityInterface + " is not an Activity implementation : " + activityClassName, e);
}
return instance;
}