から通知領域にカスタムビューを使用して通知を投稿しようとしていますIntentService
が、Couldn't expand RemoteView
エラーが発生します。
これが私がしていることですonCreate()
:
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
icon = R.drawable.icon;
tickerText = "data upload in progress";
contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.notiflayout);
contentView.setImageViewResource(R.id.image, R.drawable.icon);
contentView.setTextViewText(R.id.text, "Hello");
contentView.setProgressBar(R.id.progressBar, 100, 10, false);
whatNext = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), starterActivity.class), 0);
notification = new Notification(icon, tickerText, System.currentTimeMillis());
notification.contentView = contentView;
notification.contentIntent = whatNext;
notify()
から電話をかけonHandleIntent()
、の通知をキャンセルしていonDestroy()
ます。
このコードが、を持たない独立したアプリで機能することを確認しましたIntentService
。でこれを行うことIntentService
はどういうわけか問題を与えています。
誰かが私が間違っているのは何ですか?