mardi 29 octobre 2019

Android override private method by reflection

Hello I have class with private method, and I need override it by reflation. I see many examples fro change private fields, or call private methods, but I don't found any override example.

I have this code

public class TestClass {
public void print(string str)
{
doSomeThing(str);
}

private void doSomeThing(string str)
{
Log.d("tag","printed :"+str);
}
}

but I want change Log.d("tag","printed :"+str); to Log.d("tag","printed override :"+str); or other code. How is it possible do with reflection?





Aucun commentaire:

Enregistrer un commentaire