I need proxy methods for different presentation classes in the Android UI Framework, like TextView . Especially TextView#setText(int resId) . This method is not part of the interface. Therefore, Java Proxy will not work because it only works for interfaces. I need to use bytecode manipulation.
I found a library called dexmaker that seemed promising. I assume that I need to perform runtime byte manipulation, since the Android View classes are actually available on the device. Dexmaker can proxy public methods for specific classes. Then I noticed that TextView#setText(int resId) inexplicably final . The TextView class itself is not final.
I think I could develop a dexmaker to support final methods in non-final classes. Is it possible? I do not want to run this project if it is not. This would be a huge victory for my library, although developers would not need subclasses, interfaces, or manual calls to static methods to represent them. My library should know when text is set in a specific view. A proxy server is an ideal design pattern for this.
source share