GoodieBag / Pinview

A pinview library for android. :sparkles:
MIT License
823 stars 115 forks source link

Value is not exact #65

Closed oijdfdg closed 2 years ago

oijdfdg commented 3 years ago
Pinview pin = (Pinview) findViewById(R.id.pinview);
        pin.setPinViewEventListener(new Pinview.PinViewEventListener() {
            @Override
            public void onDataEntered(Pinview pinview, boolean fromUser) {
                    if(pinview.getValue() == "1234") {
                        Toast.makeText(MainActivity.this, pinview.getValue(), Toast.LENGTH_SHORT).show();
                    }
            }
        });

This should make a toast when I enter 1234 but it doesn't. Phone: Xiaomi MI 10T.

Wiwaltill commented 2 years ago

You have to write:

Pinview pin = (Pinview) findViewById(R.id.pinview);
        pin.setPinViewEventListener(new Pinview.PinViewEventListener() {
            @Override
            public void onDataEntered(Pinview pinview, boolean fromUser) {
                    if(pinview.getValue().equals("1234")) {
                        Toast.makeText(MainActivity.this, pinview.getValue(), Toast.LENGTH_SHORT).show();
                    }
            }
        });
oijdfdg commented 2 years ago

Thank you for replying to this almost year old issue.