I want to replace a function of a class where I know the source code. The problem is that I cannot override the function because it's private and also I cannot extend the class and override the whole functionallity because the bad calles are in every possible constructor.
Now I'm totally lost I don't know how I can implement that desired functionallity (theming the controls of the Android VideoView controls aka MediaController). Is there any way to replace a function with reflection or something like that? Or even is it possible not to call the construtor of the super class but the super super class?
Here is a very basic class which shows my problem:
public class Base {
public Base(int state) {
// must be called
}
}
public class Example extends Base {
public Example(int state, boolean bla) {
super(state);
badCall();
}
public Example(int state) {
this(state, false);
}
private badCall() {
// doing bad things
}
}
Also note that I need to have an instance of Example
so I cannot simply copy the class.