Solution 1 :
Here amount.text
is not String
but its CharSequence
. So, you should convert it to String
and then convert to Float
:
amount.text.toString().toFloat()
Problem :
I have this code in my DestinationCreateActivity.kt that create new data, how do i convert the text to float?
DestinationCreateActivity.kt
newDestination.amount = amount.text.toFloat()
this is my activity_destiny_create.xml
<EditText
android_id="@+id/amount"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_hint="Amount"
android_imeOptions="actionUnspecified"/>
my model
@Field("amount") amount: Float,
this is the error
Comments
Comment posted by Shalu T D
whats the issue here