Custom Validation

Hi,

I am an experienced programmer but relatively new to ODK and Android
development. I am hoping I can get some guidance from the ODK developer
community.

I need to add some custom validation that is not possible with XPath, to
validate participant ids and to calculate z-scores. The calculations for
both of these in Java is relatively simple however I cannot figure out how
to incorporate them into the software in such a way that they can be called
from the form.

I would welcome any advice/guidance and if possible a short code snippet to
help me understand how best to incorporate this functionality. Ideally, I
would create a separate package of custom functions that could be called
from various places in the form, passing in existing values as parameters.

Any help would be greatly appreciated.

With best wishes,

Kevin.