I need to set text for a particular field in android studio. It is called editID. Now, the ID is in numeric and it can be numbers only. Hence I have set the input type for that as number. But, i need to set an integer value to it from the android studio code. Here is a snippet of editID component:
android:autofillHints=""
android:ems="10"
android:hint="@string/student_id"
android:inputType="number"
android:textAlignment="center"
android:visibility="invisible"
Now in the actual kotlin class of my code i have this bit:
val st_id = item.st_id.toBigInteger() //Here I cast the value to Big Integer
val st_name = item.st_name
val message = "Are you " + st_name + " " + st_id + " ?" // Here in this message the number shows fine
MaterialAlertDialogBuilder(this)
.setTitle(resources.getString(R.string.confirmTitle))
.setMessage(message)
.setNeutralButton(resources.getString(R.string.cancel)) { dialog, which ->
dialog.dismiss()
}
.setNegativeButton(resources.getString(R.string.decline)) { dialog, which ->
dialog.dismiss()
editName.setText(st_name)
editId.setText(st_id) //But, here is the issue
with(motion_layout as MotionLayout) {
setTransition(R.id.end, R.id.firstLogin)
transitionToEnd()
If you look at my comments the issue is at setText. Whenever the application gets to this bit of code, the app crashes with the error message of "Resource not found @#XXXXXXXXX" And the LOG points me to this Line exactly.
If i am not wrong then my question is the reason for the problem. And I cannot find any solution anywhere. I don't want to have Input Type Text here. Because for the user I need to have the Numeric Only Keyboard to come up. If you guys have any solution it would help. Also I am totally new to Kotlin like, 2 days new.
Thanks
question from:
https://stackoverflow.com/questions/65896439/how-to-set-big-integer-in-android-layout-textview 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…