2013-02-25 34 views
1

我正嘗試使用遠程視圖創建自定義通知。獲取android.app.RemoteServiceException:從自定義通知中的包中發佈的錯誤通知

步驟如下:
1.創建一個佈局,並放置在res /佈局文件夾
2.擴展的RemoteViews類和實施了一些輔助方法。
3.實例化Extended類的一個對象,我通過使用Notification.Builder中的setContent()將它作爲Content提供。
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標記的函數。

回答

1

事件「setEnabled」函數在基類(View.java)中具有@RemotableViewMethod標記。這在派生類中被重寫,並且沒有@RemotableViewMethod標記。我們必須檢查子類的標籤是否被覆蓋。