I achieved something similar by subclassing a layout (in my case it was RelativeLayout) and specifying custom XML attributes.
Then when I used it in my xml files I just specified that I wanted my custom layout view and specified my custom attributes to make them slightly different (i.e. different background images, text, etc...) Not sure if the use case will work for you, but it worked like a charm in my case. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Mon, Jun 27, 2011 at 12:48 AM, TreKing <[email protected]> wrote: > On Fri, Jun 24, 2011 at 4:00 AM, muckwarrior <[email protected]>wrote: > >> Is there an easy way to do this without duplicating code? > > > protected void onCreate(Bundle bundle) > { > setContentView(R.layout.my_single_layout); > setCustomButtonImageBasedOnSubject(); > setCustomBackgroundImageBasedOnSubject(); > } > > Now implement those two functions. > > > ------------------------------------------------------------------------------------------------- > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

