What is the use of the reflection API in the Android? What are its Advantages in Respect of android and why it is necessary?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In android, Google has set some APIs hidden, so we developers can’t get access to these APIs directly. In that case, we can use Reflection feature in Java to call these APIs at runtime.
One typical application of Reflection I have used is to change the MOBILE DATA CONNECTION state, there is no such a public API for developers, however, we can use Reflection to make it. See here:
However, this is not encouraged, since hidden APIs would be changed in the future without notification . That means the app may not work at a higher API level.