リモートビューを使用してカスタム通知を作成しようとしています。
実行手順:
1。レイアウトを作成し、res /layoutフォルダーに配置しまし
た。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タグが付いている関数をたくさん試しました。