Question: I have an app ready and running in the Google Play store, now i am implementing fragments.

so,i already have a class A which extends B with some methods, now i have class which C extends FragmentActivity, so now i need use the same methods as in class A but here since i am extending FragmentActivity i cannot make use of class B, so here there are duplicate methods which are same as class A but i need to reuse the methods.

This below example shows my situation:

Eg:

**Current implementation**

```
class A extends B{

one();
two();

}

```

**After integrating fragments,**

Eg:

```
class C extends FragmentActivity{

one();// same methods as in class A
two();// same methods as in class A

}

```

1) What is the best way to re-use the methods in this case and how?

2) I have approach in my mind like creating a class and make the methods as static and re-use the methods in both A and C class, but is my approach good and can i make the methods as static and is it a good approach ?

3) Another approach that i have thought of **"Strategy Pattern".**

```
Eg:
class A extends ApiClass {
   private ClassContainingDupMethod strategy;
}

class N extends AnotherApiClass {
   private ClassContainingDupMethod strategy;

   public methodCallingDupMethod(){
      strategy.dupMethod();
   }
}

class ClassContainingDupMethod{
   public dupMethod(){;}
}

```

Is the **"Strategy Pattern".** a good approach ? as i need to create object of common class in both the classes.

Any suggestions on this would be appreciated.

Answer: 
I suspect you have some utility methods, just put them inside a class `Utils`, make them static and call them from wherever you want. I have lot of utility classes in my application like `WifiUtils`, `LogUtils`, `NumberUtils` and so on.
Strategy Pattern or 'wrapper' is the best choice. And I think Juan Sánchez's solution is better than Babibu's one. As in Babibu's code, class A should not be dependent on D. Be dependent on an interface is better.
In your code, if class A contains some attributes or some actions that class C doesn't need, you can refactor your code like below. Otherwise Juan's solution is enough.
I've drawn an UML image for this situation, but I've no enough reputation to post it:-(
Code is like this:

```
interface IAction
{
   public void actionA();
}

class A extends B implements IAction
{
   private IAction action;
   public void actionA() {
      action.actionA();
   }
}

class C extends FragmentActivity implements IAction
{
   private IAction action;
   public void actionA() {
      action.actionA();
   }
}

class D implements IAction
{
   public void actionA() {
   // put implementation here
   }
}

```