thyrlian/AwesomeValidation

error getColor()

sondangpangaribuan opened this issue · 1 comments

hi.. get error like this
Process: com.belisip.affiliate, PID: 10687
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.getColor(int)' on a null object reference
at android.support.v4.content.ContextCompatApi23.getColor(ContextCompatApi23.java:32)
at android.support.v4.content.ContextCompat.getColor(ContextCompat.java:432)
at com.basgeekball.awesomevalidation.validators.UnderlabelValidator.trigger(SourceFile:52)
at com.basgeekball.awesomevalidation.AwesomeValidation.validate(SourceFile:139)
at com.belisip.affiliate.fragments.AlamatPemesan$4.onClick(AlamatPemesan.java:142)
at android.view.View.performClick(View.java:6213)
at android.widget.TextView.performClick(TextView.java:11074)
at android.view.View$PerformClick.run(View.java:23645)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

an on line 142 error is:
next.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View view) {
if(mAwesomeValidation.validate()) { <-- line 142

                ((CheckOut) getActivity()).next();
            }
        }
    });

i don't know whats wrong....
any suggestion ???

Hi, this is clear that the context is null.

I guess you are using UNDERLABEL validation style, and probably forget to set context by:

mAwesomeValidation = new AwesomeValidation(UNDERLABEL);
mAwesomeValidation.setContext(this);