hm...  looks like I should use this --
http://developer.android.com/reference/java/lang/reflect/Field.html

also, I don't think a try/catch will work - the java pre-verifier will
choke before it gets to running it... eh?

On Nov 11, 11:54 am, sdphil <[email protected]> wrote:
> oh, cool, thanks.
>
> I see this sample 
> --http://android-developers.blogspot.com/2009_04_01_archive.html
> but it is doing it for a method, as opposed to a static final constant
> like i want.
>
> also, could I just put a try/catch around it and return "unknown" if
> an exception was thrown?
>
> -phil
>
> On Nov 11, 11:43 am, Mark Murphy <[email protected]> wrote:
>
> > sdphil wrote:
> > > i want to use --
> > > android.os.Build.MANUFACTURER
>
> > > but it is not available in 1.5.  i went to do this then --
> > > public static String getMfg() {
> > >   if (compareVersion(android.os.Build.VERSION.RELEASE, "1.6") >= 0) {
> > >     return android.os.Build.MANUFACTURER;
> > >   }
> > >   return "unknown";
> > > }
>
> > > but that does not work.  as soon as I try to run the app, it crashes
> > > because it's trying to get at that before checking he conditional.  so
> > > what's the best strategy for dealing with this?
>
> > Reflection. If you are on 1.6+, use reflection to get at the value. If
> > you are on 1.5, return "unknown".
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android App Developer Training:http://commonsware.com/training

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