I have been scouring through the stackoverflow questions about this issue but I have yet to find the reason why even though the onSaveInstanceState was called when I view the logcat I still could not get the bundled information that was saved during that period into my application
const variables
const val KEY_REVENUE = "revenue_key"
const val KEY_DESSERT_SOLD = "dessert_sold_key"
onCreate function
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
other codes
if (savedInstanceState != null) {
revenue = savedInstanceState.getInt(KEY_REVENUE, 0)
dessertsSold = savedInstanceState.getInt(KEY_DESSERT_SOLD, 0)
}
}
onSaveInstanceState function
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
Log.d(TAG, "onSaveInstanceState Called")
outState.putInt(KEY_REVENUE, revenue)
outState.putInt(KEY_DESSERT_SOLD, dessertsSold)
}
Tried searching up the reason for this happening and I also reviewed my code and the logcat a few times and tried to run this on a few different devices but I still could not figure it out but I think it is just some simple mistake I am not seeiing