ContentValues類和Hashtable比較類似,它也是負責儲存一些名值對,但是它儲存的名值對當中的名是一個String類型,而值都是基本類型。我們回顧一下,在上一個例子當中,我們是通過SQL語句進行插入操作,SQL語句的好處是比較直觀,但是容易出錯。但是在這個例子當中我們有更好的辦法,在這裡我們將要插入的值都放到一個ContentValues的執行個體當中ContentValues initialValues = new
轉自http://www.androidnote.com/Article_Show.asp?ArticleID=608ContentUris是content URI的一個輔助類。它有兩個方法很有用,具體如下所示。1. public static Uri withAppendedId(Uri contentUri, long id),這個方法負責把id和contentUri串連成一個新的Uri。比如ContentUris.withAppendedId(Diary.
要慎用,否則很消耗電源。官方的例子PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); wl.acquire();..screen will stay on during this section..
http://blog.csdn.net/liujian885/archive/2010/03/22/5404834.aspx 在 android 的API中有提供SystemClock.setCurrentTimeMillis()函數來修改系統時間,可惜無論你怎麼調用這個函數都是沒用的,無論模擬器還是真機,在logcat中總會得到"Unable to open alarm driver: Permission denied".這個函數需要root許可權或者運行與系統進程中才可以用。
轉自http://jinguo.iteye.com/blog/718742首先定義一個自訂類。注意紅色部分。public class MyClass implements Serializable{private int number;private int max;private int min;private ArrayList<String> url;public void SetNumber(int number){ this.number =
很多網友可能發現了Android的Bitmap對象無法儲存成為一個bmp檔案,即提供的方法只有 compress(Bitmap.CompressFormat format, int quality,OutputStream stream),可以存為png和jpg,png可能還好說,但是jpg是有損壓縮會降低圖片的品質,其實Google還提供了一個API在Bitmap類,通過copyPixelsToBuffer(Buffer