Android solving compatibility with SDK_INT hack; is this ok?

前端 未结 2 712
-上瘾入骨i
-上瘾入骨i 2021-01-17 02:29

Running the following (note: target > 3.0)

ActionBar actionBar = getActionBar();

on Android with version < 3.0 (SDK 11) results in a

相关标签:
2条回答
  • 2021-01-17 03:20

    I believe so, as long as everything is setup correctly.

    From Reto Meier's blog: http://blog.radioactiveyak.com/2011/02/strategies-for-honeycomb-and-backwards.html

    0 讨论(0)
  • 2021-01-17 03:23

    It looks like this works due to the JIT compiler. This code fails on SDK < 2.1, which supports this theory. Regardless, this probably isn't a reliable way to avoid reflection.

    0 讨论(0)
提交回复
热议问题