On Fri, Dec 17, 2010 at 7:10 AM, Neilz <[email protected]> wrote:
> Hi all. The examples at...
>
> http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html
>
> ...show some good ideas of testing methods against incompatible
> versions.
>
> But the method I want to call is DisplayMetrics.densityDpi(); (since
> level 4) which returns an int value. None of these examples return any
> values, they're all void.

The second half of that post returns an int from doStuff() in both
NewClass and the WrapNewClass wrapper.

However, densityDpi is a field, not a method, on DisplayMetrics. For
that, you could just use reflection. Here is an example of using
reflection to conditionally access a field (albeit a static data
member, not an instance data member):

https://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Pick

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

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