Use ViewStub. Layout of viewStub is your layout containing 3 buttons. So, whenever you need the buttons, just inflate the viewStub.
Nithin On Dec 23, 3:01 pm, Samuh <samuh.va...@gmail.com> wrote: > In my application I have three buttons that are to be part of each and > every activity. These button are independent of each other and on > click do mutually exclusive things(say launch different activity). > So, in my layout XML for every screen I have a <LinearLayout><Button/ > > ><Button/><Button/></LinearLayout> element. > > As I understand, at run time, if there are 5 screens, the number of > Button objects created would be 5 x 3 = 15.Assuming that all the five > activities are on stack. > > However, If i create a custom view and have these three Buttons as its > static members and then add this custom view in layouts of every > screen, at runtime, I will have just 3 Button Objects. However, these > three instances being static will last longer. > > Which amongs the two approaches mentioned is better and perhaps > advisable? > > Thanks. -- 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