> Create a helper class, sometimes static if it makes sense, that does the > work you find yourself copying and pasting. For GPS, for example, I have a > class that takes care of starting and stopping the GPS funtionality, keeps > track of the current location, can return it in various forms (coordinates, > named location, etc), notifies of location updates, and handles other > related tasks. > > Each activity that requires it just instantiates it with the proper > parameters (provider, criteria, frequency, etc), calls start and stop as > necessary, and lets the class handle the rest. >
Which is what I did while waiting for an answer. I know that code duplication is bad, I just needed the best way to fix it. Since java does not support multiple inheritance, creating a superclass just for share the code doesn't feel so natural, which is the reason why I went for the helper class. Many thanks for the complete and detalied answer. Federico -- 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