kec6227 wrote:
> Using? a wrapper class of sorts? If I initiate the WallpaperManager
> anywhere in my code, it will throw a VerifyError on older platforms, I
> tried something like this:
>
> if(Integer.parseInt(Build.VERSION.SDK) >= 5){
> WallpaperManager wallMan..
> ...blah blah
> }
>
> The only way it does not throw a verifyerror is when I don't use the
> WallpaperManager anywhere.
That's not strictly true. You only will get a VerifyError if you load a
class that refers to WallpaperManager.
So, the trick is to use reflection or conditional class loading to only
load your code referencing WallpaperManager on suitable versions.
For example:
if(Integer.parseInt(Build.VERSION.SDK) >= 5){
new MyWallpaperBridge().goDoSomething();
}
Or, create an interface and two implementations, and choose the
implementation based on the version, as seen here:
http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android Training in US: 14-18 June 2010: http://bignerdranch.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en