runtime API level detection

by jason...@spy.net » 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, "jason...@spy.net" <jasonleehudg...@gmail.com>



Some thoughts on wrappers:

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

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. Activity dispatchKeyEvent sometimes loses UP

I'm watching for ACTION_DOWN/ACTION_UP for KEYCODE_VOLUME_UP and
KEYCODE_VOLUME_DOWN and using these for purposes other than volume.

There are really 3 questions here.

1) In some rare cases, I will see the button down but no associated
button up.  There should be no reason for a focus change.  When should
I and shouldn't I see events in the Activity dispatchKeyEvent?  Are
release events ever expected to be lost?  (Could a background task
using high CPU cause this?)

2) Upon ACTION_UP, a ProgressDialog is displayed.  Are the following
behaviors correct?
a) The Activity does not see KEYCODE_VOLUME_UP or KEYCODE_VOLUME_DOWN
while the ProgressDialog is up
b) While the ProgessDialog is up, these keys allow adjustment of
volume
c) If I watch for OnKey event in the ProgressDialog, I don't see
KEYCODE_VOLUME_UP or KEYCODE_VOLUME_DOWN

3) Is there a way to poll to see if VOLUME_UP or VOLUME_DOWN is
currently being pressed?  (If the release event sometimes gets lost,
at least I could try to poll to check for release.)

-Mike

-- 

2. Decimal only keypad

I want to have input type for the text boxes that only takes numbers
and decimal point.

Input type of Number or Decimal, still brings the full keypad and the
buttons are small.

Input type of Phone does the trick, but not all phones have a comma or
a dot to enter the decimal point.

What is the best way around?

Thanks in advance.

-- 

3. How to open a new activity when an expandableList row is clicked ?

4. problem to install .apk on phone

5. Retrieve Screen Size through XML

6. Android segmentation resolution

7. FB game lover....cekidot:-)