I'm trying to build my own layout programmatically then 'building' RemoteViews
and show it as a notification.
Skeleton :
LinearLayout baseLayout = new LinearLayout(context);
for (X) {
LinearLayout innerLayout = new LinearLayout(context);
for (Y) {
TextView textV = new TextView(context);
}
innerLayout.addView(textV);
}
baseLayout.addView(innerLayout);
}
RemoteViews remoteView = new RemoteViews(getPcakageName(), baseLayout.getId());
For each Layout I set LayoutParams
, orientation
and ID
from the method presented here : https://stackoverflow.com/a/15442898/1405268.
When I try to start the notification with the RemoteViews
, I get `Bad notification posted from package XXX: Couldn't expand RemoteViews for StatusBarNotification...
Thanks
I'm trying to build my own layout programmatically then 'building' RemoteViews and show it as a notification
The ID passed to the RemoteViews
constructor needs to be a layout resource ID. You then need to use methods on RemoteViews
to attempt to build your structure, though I am dubious that it will work.