Couldn't expand RemoteViews

后端 未结 5 1023
孤街浪徒
孤街浪徒 2021-02-12 14:34

I try to create a custom notification but getting the following exception:

FATAL EXCEPTION: main
android.app.RemoteServiceException: Bad notification posted from         


        
5条回答
  •  失恋的感觉
    2021-02-12 14:56

    For me, it was because I was setting the text inside the remoteViews TextViews incorrectly. I was doing this:

    remoteViews.setString(R.id.txt, "setText", "text");
    

    Using one of these methods solved it for me:

    remoteViews.setCharSequence(R.id.txt, "setText", "text");
    //Or simply:
    remoteViews.setTextViewText(R.id.txt, "text");
    

提交回复
热议问题