Skip to content

Instantly share code, notes, and snippets.

@0xtmphey
Last active October 16, 2019 07:04
Show Gist options
  • Save 0xtmphey/4823625009277af84d99e8240868c949 to your computer and use it in GitHub Desktop.
Save 0xtmphey/4823625009277af84d99e8240868c949 to your computer and use it in GitHub Desktop.
class Activity {
lateinit var notificationManager: NotificationManager
override fun onCreate() {
super.onCreate()
// lateinit allows to access property without initialization and check for null
// this will cause a crash
notificationManager.readNotification()
notificationManager = NotificationManager()
// After initialization we can easily access it
notificationManager.readNotification()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment