Using the example code I'm tyring to add a custom layout for notification, but nothing shows up. Can anyone help me out?
---------------------<code chunk 1>----------- RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.mynotification); contentView.setImageViewResource(R.id.image, R.drawable.icon); contentView.setTextViewText(R.id.title, "Custom notification"); contentView.setTextViewText(R.id.text, "This is a custom layout"); Notification notification = new Notification(); notification.contentView = contentView; Intent notificationIntent = new Intent(this, MusicDroid.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.contentIntent = contentIntent; mNotificationManager.notify(notificationId, notification); and the mynotificaiton.xml layout is like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" > <ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_marginRight="10dp" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/image" /> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/image" android:layout_below="@id/title" /> </RelativeLayout> Thanks for your time. KK On Tue, Oct 25, 2011 at 3:12 PM, KK <dioxide.softw...@gmail.com> wrote: > thanks, got it. let me add the url for others reference > > http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomExpandedView > > --kk > > > On Tue, Oct 25, 2011 at 2:38 PM, Zsolt Vasvari <zvasv...@gmail.com> wrote: > >> I don't have any sample code. That's what the Android Samples are >> for. I am sure there is one that uses a custom layout. >> >> On Oct 25, 5:04 pm, KK <dioxide.softw...@gmail.com> wrote: >> > Hi Vasvari, >> > Thanks for your answer. I got the point that we've to use custom layout, >> but >> > dont know how do I hookup the custom layout to the notification event, >> would >> > appreciate if you can point me to some sample code. >> > >> > Thanks, >> > KK >> > >> > >> > >> > On Tue, Oct 25, 2011 at 2:15 PM, Zsolt Vasvari <zvasv...@gmail.com> >> wrote: >> > > Create your own Notification layout and set ellipsize to end. >> > >> > > On Oct 25, 4:42 pm, KK <dioxide.softw...@gmail.com> wrote: >> > > > Hi All, >> > > > Can someone tell me if its possible to move/scroll the notification >> > > message >> > > > from one direction to the other(say from right to left). If yes, >> then how >> > > to >> > > > achieve the same ? >> > > > Actually as part of my media player, I want to show current song >> title >> > > > through notification and as the space is small, I want to make it >> scroll >> > > so >> > > > that the enduser can see the full text being displayed through >> > > > notification. >> > > > Thanks for your time. >> > >> > > > Regards, >> > > > KK >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups "Android Developers" group. >> > > To post to this group, send email to >> android-developers@googlegroups.com >> > > To unsubscribe from this group, send email to >> > > android-developers+unsubscr...@googlegroups.com >> > > For more options, visit this group at >> > >http://groups.google.com/group/android-developers?hl=en- Hide quoted >> text - >> > >> > - Show quoted text - >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en