I have Activity class, ListActivity class, TabActivity class. I want expand these classes using the same functionality. For example add method toDoSomething() into each of them. It is impossible to do using мultiple inheritance in Java.
Could you please tell me desing pattern or other solution to resolve this issue without copy-paste
Thanks!
You can do less copy-paste if you define your own class
DoSomethingHelperwithdoSomething()method (probablydoSomething(Activity activity)), then refer to it from all of your activities as needed.I don’t know of any better solution.