http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html

Or actually it appears this has become a tech article:

http://developer.android.com/resources/articles/backward-compatibility.html

<http://developer.android.com/resources/articles/backward-compatibility.html>The
last section, "Using a wrapper class," talks about this.

On Tue, Apr 20, 2010 at 5:01 PM, Christopher <[email protected]
> wrote:

> Diane,
>
> Can you please explain what blog post you're referring to in your
> post?
>
> On Apr 20, 2:26 pm, Dianne Hackborn <[email protected]> wrote:
> > I suggest not using the SDK version, but just use the trick in the blog
> post
> > to detect if the class doesn't exist before trying to use it.
> >
> >
> >
> >
> >
> > On Tue, Apr 20, 2010 at 1:00 PM, kec6227 <[email protected]> wrote:
> > > Oh ok, that makes perfect sense. Thank you.
> >
> > > On Apr 20, 12:11 pm, Mark Murphy <[email protected]> wrote:
> > > > 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/Spinn...
> >
> > > > --
> > > > 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]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > > > For more options, visit this group athttp://
> > > groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > 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]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
> >
> > --
> > 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]<android-developers%[email protected]>
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Reply via email to