Property must be initialized or be abstract

If you’d like to initialize a property outside the constructor, then late-initialized properties is what you may be looking for. Declare the property with the lateinit modifier, which will allow to skip the otherwise required initializer and will make the property access fail with exception until some meaningful value is assigned to it:

protected lateinit var sharedPreferences: SharedPreferences

Leave a Comment

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