runtime API level detection

by » Tue, 28 Apr 2009 10:58:34 GMT

Sponsored Links
 I'm trying to product a binary that is compatible with 1.1 and 1.5,
but i'm having trouble with the ViewSwitcher class behaving
different.  I'd like to create a wrapper for it, but I need a way to
programatically detect the api level at runtime.


runtime API level detection

by fadden » Wed, 29 Apr 2009 04:26:47 GMT

 On Apr 27, 7:58pm, "" <>

Some thoughts on wrappers: 

It doesn't really help if you're seeing different behavior from
existing classes/methods, because the behavior of public APIs isn't
supposed to change across revisions.  Is this something you can test
for at runtime by executing ViewSwitcher code?  (It's better to go by
"has behavior X" than "is version Y" so that your code automatically
does the right thing in future releases.)


Sponsored Links

runtime API level detection

by Tom Gibara » Wed, 29 Apr 2009 04:35:55 GMT

 I think you should be able to use android.os.Build.VERSION.SDK though I
haven't needed to use it myself yet.
This thread might also be useful:

Other Threads

1. When is View ready?

Hi All,

im playing around with Snake-Example. I wish a new start-screen for
this, with buttons like "play", "highscore" and so ... you know?
well, ich create new xml-layout with buttons. i do
setContentView(R.layout.start_layout);  to get it up - it works.
on onClick of "play"-button i do
setContentView(R.layout.snake_layout); to get the snake-screen visible
and i do start the game.
the problem is, it seems  TileView.onSizeChanged was not called, so X/
Y-counts are empy and i run in the crash.

Can anyone say me, how can i detect, what the snake-view is finished
with the draw itself?

thanks at all.


2. camera events

I run a free hosting web site which has functionality for emailing
photos to your site and having them show up on the web.  I would like
to write an android app that allows a user to authenticate to their
free website, then I would like to receive an event each time a photo
is saved.  I am hoping that I would then have enough information to
then access the photo and send it off to the user's site.

Just wondering how I can register to receive camera capture events,
and then get to the recently captured images.



3. disable item of list view in Alert Dialog

4. How to code a music player in android .......

5. Is the address of a contact really held in POSTAL_LOCATION_LATITUDE ?

6. Urgent: MapActivity - Couldn't get connection factory client (API key does not work)

7. TimerTask help