Using new sdk methods on devices running older sdks?

by Mark Murphy » Tue, 22 Dec 2009 01:47:43 GMT


Sponsored Links
 


I wouldn't do:

if (Build.VERSION.SDK.equals("5")) {

Instead, parse it to an integer and do a >=5 comparison. After all, most
DROIDs are now on API 6 (i.e., Android 2.0.1). And, once you drop older
SDK support, you can use SDK_INT and skip the parse step.

If you are going to make the request a lot, you might consider having
your two implementations extend a common abstract class or implement a
common interface. Then, you can make the determination of which one to
use once and hold onto that object, calling it by the common interface
as needed.

Otherwise, the notion of "if I don't load the class, there will be no
harm in it referencing newer API capabilities" is sound.

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

_The Busy Coder's Guide to Android Development_ Version 2.8
Available!

--



Other Threads

1. Ingpo: i Mobile

** bukan karyawan i-Mobile **
** gak dpt komisi juga dari i-Mobile **

Just ingpo ajah:

i-mobile 6010 adalah smartphone android pertama dari i-mobile dan merupakan
ponsel Android termurah yang ada di Indonesia saat ini. i-mobile 6010
dibanderol dengan harga sekitar Rp. 1.999.000. i-mobile 6010 berjalan
menggunakan sistem operasi Android versi 1.6.

i-mobile 6010 dilengkapi dengan berbagai fitur multimedia dan online yang
lengkap. i-mobile 6010 memiliki fitur-fitur multimedia seperti kamera 3.2
megapiksel, mp3 player, radio FM, video player dan recording. Sedangkan
untuk fitur online i-mobile 6010 telah dilengkapi dengan konektivitas WiFi
dan aplikasi online (Youtube, Gmail, Facebook)

-- 
"Indonesian Android Community [id-android]" 

2. --SOLVED-- (WTA) Kembaliin ukuran sd card bekas partisi

Ud bisa neh, pake recovery, di nol in swap dan ext nya.

Best Regards,
David Haryanto
*sent from my magic




Kalo pake pc pake s/w paragon partition manager

| Rgds,
Jus |
~  send using dream eclair  ~








Kalau langsung format pak...








3. OOT: Anang pun keracunan

4. UPDATED [9/3] Nexus Desire Modaco Alpha14

5. Help converting C# code

6. Live Wallpapers. Cant get actions like android.wallpaper.tap

7. Disable spinner item?