0

My java code need to access a @hide member defined in ViewTreeObserver.java. this hidden member is stable from very old release of android to the last 25, so i don't think it's too much risky (but i don't know, anyway i have no other choice). I can use reflection but it's seam a little over complicated.

i was thinking to add to my jar a dumy ViewTreeObserver.java removing the @hide from the code and compile my app like this. it's seam to work, when i call the hidden member, it's not the code in my dumy java that is executed but the code of android but i don't know if it's a good way because it's look too much easy.

other idea is to create a dumy jar with the dumy ViewTreeObserver.java, in this way i can compile my jar and can deploy it.

so what is the proper way (if their is one) to access @hide member ?

zeus
  • 12,173
  • 9
  • 63
  • 184
  • this question is very similar and should prove helpful, https://stackoverflow.com/questions/9369648/how-to-properly-use-reflection-to-access-hidden-methods-in-telephony-manager – petey May 31 '17 at 18:13
  • but this use reflection, and me i think it's more easy with dumy java file, but maybe i miss something ? – zeus May 31 '17 at 18:18
  • 1
    https://github.com/anggrayudi/android-hidden-api – pskink May 31 '17 at 19:00
  • yes i know about github, maybe this is the way to go ? – zeus May 31 '17 at 20:45

0 Answers0