Android solving compatibility with SDK_INT hack; is this ok?

前端 未结 2 744
-上瘾入骨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: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.

提交回复
热议问题