08-23 13:42:57.649: E/AndroidRuntime(3836): FATAL EXCEPTION: main
08-23 13:42:57.649: E/AndroidRuntime(3836): android.app.RemoteServiceException: Bad notification posted from package com.test.nursery.rhymes.stories: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.test.nursery.rhymes.stories id=16104475 tag=null score=0 notn=Notification(pri=0 contentView=com.test.nursery.rhymes.stories/0x7f030012 vibrate=null sound=null defaults=0x4 flags=0x10 kind=[null]))
08-23 13:42:57.649: E/AndroidRuntime(3836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1471)
08-23 13:42:57.649: E/AndroidRuntime(3836): at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 13:42:57.649: E/AndroidRuntime(3836): at android.os.Looper.loop(Looper.java:153)
08-23 13:42:57.649: E/AndroidRuntime(3836): at android.app.ActivityThread.main(ActivityThread.java:5000)
08-23 13:42:57.649: E/AndroidRuntime(3836): at java.lang.reflect.Method.invokeNative(Native Method)
08-23 13:42:57.649: E/AndroidRuntime(3836): at java.lang.reflect.Method.invoke(Method.java:511)
08-23 13:42:57.649: E/AndroidRuntime(3836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
08-23 13:42:57.649: E/AndroidRuntime(3836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
08-23 13:42:57.649: E/AndroidRuntime(3836): at dalvik.system.NativeStart.main(Native Method)
Can someone help me get this kind of problem when I send a push notification when the application is down. please help ... code is requested for this problem. also want to understand the detailed view of distance views. I tried to learn it from the developer's site. but perhaps better explain there. also please insert some useful links for this.
as follows:
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(res_icon, message, when);
Intent notificationIntent = new Intent(context, FisrtActivityClass);
notificationIntent.putExtra("message", message);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context,
notificationid, notificationIntent, 0);
MyLog.d(TAG, custom_layout_id + "; text");
try {
MyLog.d(TAG, "layout = " + custom_layout_id + "; image = "
+ custom_image_id + "; text = " + custom_text_id);
RemoteViews contentView = new
RemoteViews(context.getApplicationContext().getPackageName(),
custom_layout_id);
contentView.setImageViewResource(custom_image_id, res_icon);
contentView.setTextViewText(custom_text_id, message);
notification.contentView = contentView;
notification.contentIntent = contentIntent;
notification.setLatestEventInfo(context, title, message,
contentIntent);
} catch (Exception e) {
e.printStackTrace();
notification.setLatestEventInfo(context, title, message,
contentIntent);
}
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notificationManager.notify(notificationid, notification);
source
share