【问题标题】:Getting android.app.RemoteServiceException: Bad notification posted from package in custom notification获取 android.app.RemoteServiceException:从自定义通知中的包发布的错误通知
【发布时间】:2013-02-28 19:03:09
【问题描述】:

我正在尝试使用远程视图创建自定义通知。

遵循的步骤:
1.创建一个布局并放置在res/layout文件夹中
2. 扩展了 RemoteViews 类,实现了一些辅助方法。
3. 实例化扩展类的对象,我通过在 Notification.Builder 中使用 setContent() 将其作为内容提供。
4.缓存实例化的Extended类。

现在大多数时候,即使在将扩展类对象提供给 Notification.Builder 之前,我也会执行操作,但它会崩溃。

E/AndroidRuntime(10194): android.app.RemoteServiceException: Bad notification posted from
package com.motorolasolutions.ptt.mpttclient: Couldn't expand RemoteViews for: 
StatusBarNotification

我尝试了以下功能

setBoolean(R.id.textview1, "setEnabled", false);

请告诉我如何调用远程视图上的函数。

我尝试了很多Android源代码中带有@android.view.RemotableViewMethod标签的功能。

【问题讨论】:

    标签: android remoteview


    【解决方案1】:

    尽管“setEnabled”函数在基类 (View.java) 中有 @RemotableViewMethod 标记。这在派生类中被覆盖,并且没有 @RemotableViewMethod 标记。我们必须检查子类的标签是否被覆盖。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-18
      • 1970-01-01
      • 1970-01-01
      • 2014-09-18
      • 1970-01-01
      • 2018-03-28
      • 1970-01-01
      • 2018-06-15
      相关资源
      最近更新 更多