kotlin.TypeCastException: null cannot be cast to non-null type com.midsizemango.databasekotlin.Note

In this line:

note = intent.getSerializableExtra(EXTRA_NOTE) as Note

Note is a non-null type, so the cast to it triggers a null check. Since you’re comparing note to null manually afterwards, probably you meant the safe cast operator, which yields null if the expression is not of the type specified in the right-hand side:

note = intent.getSerializableExtra(EXTRA_NOTE) as? Note

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)