To add on, dont forget to add the constructor to the PlayBackView with context and AttributeSet
i.e. public PlayBackrView(Context context, AttributeSet attrs) { super(context, attrs); ...... ...... } On Nov 30, 11:52 am, akkilis <deepakverma.u...@gmail.com> wrote: > Mahesh, > > Why dont you make a different class, say PlayBackView, extending > LinearLayout and place the layout of the common component "Playback > bar" in a different layout xml, say playback.xml. > > Now inflate the playback.xml in the PlayBackView. > > Now you can add this your custom view in any of the layout xml (home, > A, B, C) > as: > > <?xml version="1.0" encoding="utf-8"?> > <FrameLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:orientation="vertical" android:layout_width="fill_parent" > android:layout_height="fill_parent"> > <com.packagename.PlayBackView > android:id="@+id/playbackview" > android:layout_width="match_parent" > android:layout_height="wrap_contentt" /> > > <ImageView ------- etc etc/> > </FrameLayout> > > In the PlayBackView class, you can define the onClick handlers or any > other event handler as you want. > Hope this will help you. > > On Nov 30, 7:59 am, MaheshSharma <maheshsharmasuco2...@gmail.com> > wrote: > > > Hello All, > > My app is kind of a music app and I have a playback bar that I need to > > be visible across all the views. > > > I had three activities, A/B/C. Instead of adding the playback bar > > explicitly to all A,B,C. I added the Playback Bar to A and made A,B,C > > as ActivityGroups. > > > Since, A has the playback bar, now I when I start B from A, I call > > setContentView from A to show B. > > > The problem is, once I call setContentView to show B, and then if the > > user presses back key in B, then it goes to home screen, instead of > > coming to A. > > > I have seen some snippets on web, which maintain the view stack and > > when user presses the back key they pop up the previous view. > > > I couldnt implement that. > > > Questions : > > 1) Is there any better way to having a activity like Playback bar/ > > Status bars across all the views/activities ? > > > 2) If the above way is the only way to do it,then how can I handle the > > back key? > > > With Regards > > MS. -- 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