Android and reflection

前端 未结 5 951
臣服心动
臣服心动 2020-12-13 13:48

I get the impression that Android supports reflection. But does it really? How sensible would it be to rely on reflection heavily? What\'s the penalty?

5条回答
  •  Happy的楠姐
    2020-12-13 14:01

    There is a nice example of reflection in the sample code as well, in BusinessCard. This method wont result in a bunch of expections being thrown, so it should be much more performance friendly. It is also, in my opinion, easier to implement. Especially if it concerns a previously unimplemented method.

    Here is where it is used: http://developer.android.com/resources/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessor.html

提交回复
热议问题