I am changing a Relativelayout color in status bar notification with the following code
notificationLayout.setInt(R.id.notiMainRl,"setBackgroundColor",context.getColor(R.color.notification_bg));
but sometime my app crashing with following error
android.app.ActivityThread$H.handleMessage
android.app.RemoteServiceException - Bad notification posted from package com.app.myapp:
Couldn't inflate
contentViewsandroid.widget.RemoteViews$ActionException:
view: android.widget.RelativeLayout doesn't have method:
setBackground(int)
full stack trace is
Fatal Exception: android.app.RemoteServiceException: Bad notification for startForeground
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1774)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6543)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
the crash is not frequent it appears on very little amount of devices