Android 2.2相容性移植

來源:互聯網
上載者:User

  1.
檔案系統,大多數網友可能發現/sdcard/的路徑已經變為/mnt/sdcard/了,所以過去寫入程式碼相關的軟體需要通過
android.os.Environment.getExternalStorageDirectory().getAbsolutePath()這樣
的方法來擷取sdcard路徑。

 

  2.
app2sd,這項功能,可以在settings中開關設定啟用,PackageManager類多了一些新的標記,為了相容性我們使用反射動態調用比較
可靠,判斷API Level的方法為Build.VERSION.SDK,注意這是String類型的,返回直接為數字,比如返回8為Android
2.2。

 

 3. GPS開關,很多LBS的應用我們需要開關GPS,在Android
1.5開始GPS的開關方法又有了新的方式,而考慮到安全系統引入的android.provider.Settings.Secure包,有關GPS的
開關可以使用setLocationProviderEnabled(ContentResolver cr, String provider,
boolean enabled) ,Android123提示這方法在API Level為8以前並不公開,通過編譯Android
Framework或反射在部分機器調用時需要OEM的簽名才能正常工作。

 

 4. fill_parent改名為match_parent,不過這樣看起來沒有過去形象,有關Android 2.2的改進,還是希望大家關注Android開發網的移植板塊。

 

http://tonyyu.iteye.com/blog/753466

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.