Android 2.3 Custom notification keep giving android.app.RemoteServiceException: Bad notification posted from package: Couldn't expand RemoteViews -


i trying show custom notification in android 2.3 no clickable items.

this xml:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/layout"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:padding="10dp" >      <imageview         android:id="@+id/image"         android:layout_width="40dp"         android:layout_height="40dp"         android:layout_alignparentleft="true"         android:layout_marginright="10dp"         android:contentdescription="@string/app_name"         android:scaletype="fitxy"         android:src="@drawable/icon" />      <linearlayout         android:id="@+id/linearlayout"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centervertical="true"         android:layout_torightof="@id/image"         android:orientation="vertical" >          <textview             android:id="@+id/title"             style="@style/notificationtitle"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="this event name" />          <textview             android:id="@+id/text"             style="@style/notificationtext"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="by name name" />     </linearlayout>   </relativelayout> 

this code:

public void show(picoevent event) {     notification notification = new notification();     notificationmanager notificationmanager = (notificationmanager)context.getsystemservice(context.notification_service);     remoteviews contentview = new remoteviews(getclass().getpackage().getname(), r.layout.notification);     intent notificationintent = new intent(context, mainactivity.class);     pendingintent contentintent = pendingintent.getactivity(context, 0, notificationintent, 0);          contentview.settextviewtext(r.id.title, event.getname());     contentview.settextviewtext(r.id.text, event.getplace());            notification.when = 0;     notification.tickertext = "new event starting";     notification.icon = r.drawable.icon;             notification.contentintent = contentintent;     notification.contentview = contentview;     notificationmanager.notify(0, notification); } 

and yet exception logcat:

09-04 12:15:26.140: e/androidruntime(13350): android.app.remoteserviceexception: bad notification posted package com.coapps.pico: couldn't expand remoteviews for: statusbarnotification(package=com.coapps.pico id=0 tag=null notification=notification(vibrate=null,sound=null,defaults=0x0,flags=0x0)) 09-04 12:15:26.140: e/androidruntime(13350):    @ android.app.activitythread$h.handlemessage(activitythread.java:1048) 09-04 12:15:26.140: e/androidruntime(13350):    @ android.os.handler.dispatchmessage(handler.java:99) 09-04 12:15:26.140: e/androidruntime(13350):    @ android.os.looper.loop(looper.java:130) 09-04 12:15:26.140: e/androidruntime(13350):    @ android.app.activitythread.main(activitythread.java:3691) 09-04 12:15:26.140: e/androidruntime(13350):    @ java.lang.reflect.method.invokenative(native method) 09-04 12:15:26.140: e/androidruntime(13350):    @ java.lang.reflect.method.invoke(method.java:507) 09-04 12:15:26.140: e/androidruntime(13350):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:907) 09-04 12:15:26.140: e/androidruntime(13350):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:665) 09-04 12:15:26.140: e/androidruntime(13350):    @ dalvik.system.nativestart.main(native method) 


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -