Created
October 9, 2018 06:04
-
-
Save bapspatil/ca47df4c0ea97050df157673919035c0 to your computer and use it in GitHub Desktop.
MySliceProvider: Creating a SliceAction
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
private fun createActivityAction(): SliceAction? { | |
// (1) Create a SliceAction as follows. | |
return SliceAction.create( | |
/* (2) | |
** Pass in a PendingIntent, | |
** icon to display on the slice, | |
** size of the icon, and | |
** and the title of the action, | |
** to handle the on-click action for a Slice. | |
*/ | |
PendingIntent.getActivity( | |
context, 0, Intent(context, MainActivity::class.java), 0 | |
), | |
IconCompat.createWithResource(context, R.drawable.ic_launcher_foreground), | |
ListBuilder.ICON_IMAGE, | |
"Open App" | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment