Android Question NotificationBuilder Custom Layout

stefanoa

Active Member
Licensed User
Longtime User
Does anyone have an example of how to use the NotificationBuilder library with Custom Layout and his XML file?
I only know XML file must be in the folder Objects\res\layout and must be Read-Only but I did not find information about which code to write to and the code for the function (Dim nbCustomStyle As NotificationCustomLayout, nbCustomStyle.initialize("xmlfile"), etc.)
I should display an image and 3 buttons, in addition to the text (for a music player)
thanks

Layout example:
Screenshot_20180226-195429.jpg
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

stefanoa

Active Member
Licensed User
Longtime User
Upvote 0

stefanoa

Active Member
Licensed User
Longtime User
As it must be XML (Android default). Ask Google.
ok thanks,
but how should I match the CustomLayout to the NotificationBuilder?
The SETSTYLE method does not provide the CustomLayout as a parameter, but only BigText, BinPicture and Inbox
(ex. notificationBuilder.SetStyle (nbCustomStyle) gives me an error)
B4X:
notificationBuilder.Initialize
    notificationBuilder.SmallIcon = "icon"
    notificationBuilder.Ticker = "Ticker"
    notificationBuilder.ContentTitle = pSongName
    notificationBuilder.ContentText = pAlbumName
    notificationBuilder.SubText = pArtistName
    notificationBuilder.OnGoingEvent = True
    notificationBuilder.Number = 1
    
    nbCustomStyle.Initialize("songnotification")
    nbCustomStyle.SetImage("cover",coverImage)   
    nbCustomStyle.SetTextColor("songTitle",Colors.Black)
    nbCustomStyle.SetTextColor("albumTitle",Colors.Blue)
    
    notificationBuilder.SetStyle(nbCustomStyle) <<<< ERROR

    notificationBuilder.Notify(1)
 
Upvote 0
Top