So I have class named Bidding.kt, and I have companion object in that class to be passed to the MainActivity.kt class. Also I have a function that returns as int value.
companion object {
const val bidInputKey = "bidInput"
}
val bidInput = returningBid() //this function returns an int value
val returnIntent = Intent().apply {
putExtra(bidInputKey, bidInput)
}
In the MainActivity.kt class, when I called the bidInput to be assigned to a new variable and passed it into a class's parameter, it required to be converted to Int (I set the class's parameter data type as Int). I don't understand why it changed the data type and detect it as a String, I declare it as Int on Bidding class.
class openBid(var input: Int) {
//doing some stuff here
}
val puttingBid = Bidding.bidInputKey
val addBid = openBid(puttingBid) // I get error in this line because
// puttingBid is detected as a String, not Int
I can avoid the error by adding .toInt() when declaring puttingBid, but I want to know why the data type is changed by itself.