Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null pointer exception #19

Open
wizardkhinz18 opened this issue Sep 3, 2018 · 1 comment
Open

null pointer exception #19

wizardkhinz18 opened this issue Sep 3, 2018 · 1 comment

Comments

@wizardkhinz18
Copy link

xml code

<ImageView
    android:id="@+id/imageView"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:layout_centerHorizontal="true"
    android:elevation="4dp"
    android:src="@mipmap/ic_image_placeholder"
    tools:ignore="ContentDescription"/>

<com.kevalpatel.passcodeview.PinView
    android:id="@+id/pinView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/imageView"
    app:dividerColor="@color/colorPrimaryDark"
    app:fingerprintDefaultText="Scan your finger to unlock application"
    app:fingerprintEnable="true"
    app:fingerprintTextColor="@color/colorAccent"
    app:fingerprintTextSize="16dp"
    app:giveTactileFeedback="true"
    app:titleTextColor="@android:color/white"/>

java code

public class AuthPINFragment extends MainFragment{

private final String TAG = AuthPINFragment.class.getSimpleName();

@BindView(R.id.pinView)PinView pinView;

@Override
protected int getLayoutResource() {
    return R.layout.auth_pin_fragment;
}

@Override
protected void initWidget(View view) {
    ButterKnife.bind(this, view);
}

@Override
protected void initListener() {

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    return super.onCreateView(inflater, container, savedInstanceState);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final int[] correctPin = new int[]{1, 2, 3,4};
    pinView.setPinAuthenticator(new PasscodeViewPinAuthenticator(correctPin));
    pinView.setKey(new RoundKey.Builder(pinView)
            .setKeyPadding(10f)
            .setKeyStrokeColorResource(R.color.colorAccent)
            .setKeyStrokeWidth(3f)
            .setKeyTextColorResource(R.color.colorAccent)
            .setKeyTextSize(18f));
    pinView.setIndicator(new CircleIndicator.Builder(pinView)
            .setIndicatorRadius(10f)
            .setIndicatorFilledColorResource(R.color.colorAccent)
            .setIndicatorStrokeColorResource(R.color.colorAccent)
            .setIndicatorStrokeWidth(3f));
    pinView.setPinLength(PinView.DYNAMIC_PIN_LENGTH);
    pinView.setTitle("Enter the PIN");
    pinView.setAuthenticationListener(new AuthenticationListener() {
        @Override
        public void onAuthenticationSuccessful() {
            CommonUtil.showDialog(getActivity(), "Success");
        }

        @Override
        public void onAuthenticationFailed() {
            CommonUtil.showDialog(getActivity(), "Failed");
        }
    });
}

}


error log

09-03 14:07:10.359 4539-4539/ph.com.sdsolutions.networkmonks E/AndroidRuntime: FATAL EXCEPTION: main
Process: ph.com.sdsolutions.networkmonks, PID: 4539
java.lang.NullPointerException: Attempt to read from null array
at com.kevalpatel.passcodeview.internal.BoxKeypad.measureView(BoxKeypad.java:181)
at com.kevalpatel.passcodeview.PinView.measureView(PinView.java:182)
at com.kevalpatel.passcodeview.internal.BasePasscodeView.onMeasure(BasePasscodeView.java:212)
at android.view.View.measure(View.java:18855)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:716)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:462)
at android.view.View.measure(View.java:18855)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:716)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:462)
at android.view.View.measure(View.java:18855)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6107)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
at android.view.View.measure(View.java:18855)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6107)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18855)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6107)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:18855)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6107)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18855)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6107)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2780)
at android.view.View.measure(View.java:18855)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2139)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1236)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1472)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1127)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6156)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:892)
at android.view.Choreographer.doCallbacks(Choreographer.java:704)
at android.view.Choreographer.doFrame(Choreographer.java:640)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:878)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5628)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:853)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:737)

@rt1shnik
Copy link

Answered here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants