omadahealth / LolliPin

A Material design Android pincode library. Supports Fingerprint.
MIT License
1.6k stars 426 forks source link

I cannot set dynamic value to KeyboardButtonView #176

Open mainaviTech opened 6 years ago

mainaviTech commented 6 years ago

Hi, Thanks for this superb lib. Its working fine with my application. I would like to set random key values to the KeyboardButtonView objects so that formation of the keyboard keeps changing every time the user gets back to the app. Unfortunately, its not allowing me to set any value to it like other views. Could you please guide me on that? Or any suggestion?

Madina-S commented 5 years ago

Try this.

override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) for (i in 0 until 10) { val idStr = String.format(Locale.getDefault(), "pin_codebutton%d", i) val id = resources.getIdentifier(idStr, "id", packageName) val button = mKeyboardView.findViewById(id) val txt = button.findViewById(R.id.keyboard_button_textview) txt.setText("some random") } }