Skip to content

Latest commit

 

History

History
28 lines (26 loc) · 459 Bytes

shortcuts.md

File metadata and controls

28 lines (26 loc) · 459 Bytes

Shortcuts

Get service

Old:

val notificationManager =
    context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

New:

val notificationManager = context.getSystemService(NotificationManager::class.java)

Write to SharedPreferences

Old:

val editor = sharedPref.edit()
editor.run {
    putString(MY_KEY, value)
}
editor.apply()

New:

sharedPref.edit(commit = true) {
    putString(MY_KEY, value)
}