Search code examples
androidandroid-recyclerviewremoteview

RecyclerView inside a RemoteView


Is there any way to set and update a RecyclerView inside a RemoteView? I want to show a RecyclerView inside a notification. I already set the custom view inside a notification, but I'm unable to set data in the RecyclerView, see here:

// my playout passed here have a Recycler View
// How to findViewById there and set my data?
val contentView = RemoteViews(packageName, R.layout.notification_layout)
val mBuilder = NotificationCompat.Builder(this)
                    .setSmallIcon(R.mipmap.ic_launcher)
                    .setContent(contentView)

Solution

  • No, you can't. The notification has fixed max size, and even if you could send your custom RemoteView, there isn't option for using ListView or RecyclerView and filling them with Adapter.