Last active
May 28, 2017 19:10
-
-
Save akbarsha03/a1ff888bb6a5fd997182b2b5bdbd32e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NotificationCompat.Builder(this).apply builder@ { // object 1 reference | |
setSmallIcon(R.drawable.ic_launcher) | |
setContentTitle("My notification") | |
setContentText("Hello world!") | |
Intent(this, HomeActivity::class.java).apply resultIntent@ { // object 2 reference | |
TaskStackBuilder.create(this).apply { | |
addParentStack(HomeActivity::class.java) | |
addNextIntent(this@resultIntent) | |
[email protected](getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)) | |
(this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).apply { | |
notify(101, [email protected]()) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment