开发者

Avoid VerifyError overriding a method in older APIs

I'm trying to be notified when signal strength changes on Android. My application supports all the way back to Android 1.5 (API level 3), so I need something that will work for old 开发者_如何学Cand new APIs.

Android 1.5 defines the PhoneStateListener which is also available in the newest API versions. However, the old onSignalStrength changed method is deprecated and replaced with a newer method, onSignalsStrengthChanged which defines a signature accepting a single SignalStrength instance as its parameter. Unfortunately SignalStrength doesn't exist in API levels before 7.

How can I override this new method in my code without incurring a VerifyError on older versions of Android? Can I use Reflection to optionally override a method in a class based on some condition?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜