AndroidFormEnhancer icon indicating copy to clipboard operation
AndroidFormEnhancer copied to clipboard

Step 3 in Usage, where does the "helper" come from?

Open DaFrik opened this issue 9 years ago • 1 comments

Hi,

Thanks for creating this nice form validator. I am trying to use it in my project. But I got stuck in Step 3 in Usage.

DefaultEntity entity = helper.create(DefaultEntity.class);

Android Studio yelled at me for unable to resolve the "helper" variable. I am new to native android development. May I know if that helper is your own class or it's a system class? Which package should I import?

Thanks, D

DaFrik avatar Jan 22 '16 09:01 DaFrik

I dug around your code and after trial and error I found a way to fix it.

Maybe you can try change Step 3 's code to the following

    ActivityFormHelper helper = new ActivityFormHelper(DefaultForm.class, this);
    ValidationResult result = helper.validate();
    if (result.hasError()) {
        // Show error messages
        Toast.makeText(this, result.getAllSerializedErrors(), Toast.LENGTH_SHORT).show();
    } else {
        // This entity object has clean and converted data
        DefaultEntity entity = helper.create(DefaultEntity.class);
    }

DaFrik avatar Jan 22 '16 09:01 DaFrik